Part Number Hot Search : 
XC6206P AF28TC 512K32 XC6206P 1N4749 C0402 NTE5066A TSM923C
Product Description
Full Text Search
 

To Download M38230G4-XXXFP Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  description the 3823 group is the 8-bit microcomputer based on the 740 fam- ily core technology. the 3823 group has the lcd drive control circuit, an 8-channel a/ d converter, a serial interface, a watchdog timer, a rom correc- tion function, and as additional functions. the various microcomputers in the 3823 group include variations of internal memory size and packaging. for details, refer to the section on part numbering. features basic machine-language instructions ...................................... 71 the minimum instruction execution time ........................... 0.4 ? (at f(x in ) = 10 mhz, high-speed mode) memory size rom ............................................................... 16 k to 60 k bytes ram ................................................................. 640 to 2560 bytes rom correction function .............................. 32 bytes ? 2 blocks w atchdog timer .............................................................. 8-bit ? 1 programmable input/output ports ............................................ 49 input ports .................................................................................. 5 software pull-up/pull-down resistors (ports p0-p7 except port p4 0 ) interrupts ................................................. 17 sources, 16 vectors (includes key input interrupt) key input interrupt (key-on w ake-up) ...................................... 8 t imers ........................................................... 8-bit ? 3, 16-bit ? 2 serial interface ............ 8-bit ? 1 (uart or clock-synchronized) a/d converter ............ 10-bit ? 8 channels or 8-bit ? 8 channels lcd drive control circuit bias ................................................................................... 1/2, 1/3 duty ........................................................................... 1/2, 1/3, 1/4 common output .......................................................................... 4 segment output ........................................................................ 32 main clock generating circuits .............. built-in feedback resistor (connect to external ceramic resonator or quartz-crystal oscillator) sub-clock generating circuits (connect to external quartz-crystal oscillator or on-chip oscillator) power source voltage in frequency/2 mode (f(x in ) 10 mhz) ................... 4.5 to 5.5 v in frequency/2 mode (f(x in ) 8 mhz) ..................... 4.0 to 5.5 v in frequency/4 mode (f(x in ) 10 mhz) ................... 2.5 to 5.5 v in frequency/4 mode (f(x in ) 8 mhz) ..................... 2.0 to 5.5 v in frequency/4 mode (f(x in ) 5 mhz) ..................... 1.8 to 5.5 v in frequency/8 mode (f(x in ) 10 mhz) ................... 2.5 to 5.5 v in frequency/8 mode (f(x in ) 8 mhz) ..................... 2.0 to 5.5 v in frequency/8 mode (f(x in ) 5 mhz) ..................... 1.8 to 5.5 v in low-speed mode .................................................... 1.8 to 5.5 v power dissipation in frequency/2 mode ............................................... 18 mw (std.) (at f(x in ) = 8 mhz, vcc = 5 v, ta = 25 ?) in low-speed mode at x cin ................................................ 18 w (std.) (at f(x in ) stopped, f(x cin ) = 32 khz, vcc = 2.5 v, ta = 25 ?) in low-speed mode at on-chip oscillator .................. 35 w (std.) (at f(x in ) stopped, f(x cin ) = stopped, vcc = 2.5 v, ta = 25 ?) operating temperature range .................................. ?20 to 85 ? applications camera, audio equipment, household appliances, consumer elec- tronics, etc. 3823 group single-chip 8-bit cmos microcomputer rej03b0146-0202 rev.2.02 jun.19.2007 rev.2.02 jun 19, 2007 page 1 of 73 rej03b0146-0202
rev.2.02 jun 19, 2007 page 2 of 73 rej03b0146-0202 3823 group package code : plqp0080kb-a (80p6q-a) (80-pin plastic-molded lqfp) pin configuration (top view) fig. 2 m3823xgx-xxxhp pin configuration 1 2 3 4 7 8 9 10 11 12 13 14 15 16 17 18 19 20 5 6 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 p1 4 /seg 28 p1 5 /seg 29 p1 6 /seg 30 p1 7 /seg 31 p4 2 /int 0 v cc x in x out v ss reset p7 0 /x cout p7 1 /x cin p4 1 / p4 0 p4 3 /int 1 seg 10 p3 5 /seg 13 p3 6 /seg 14 p3 7 /seg 15 p0 0 /seg 16 p0 3 /seg 19 p0 4 /seg 20 p0 5 /seg 21 p0 6 /seg 22 p0 7 /seg 23 p1 1 /seg 25 p1 2 /seg 26 p1 0 /seg 24 p0 1 /seg 17 p0 2 /seg 18 p1 3 /seg 27 com 3 p6 0 /an 0 p5 7 /adt p5 6 /t out p5 4 /cntr 0 p5 3 /rtp 1 p5 2 /rtp 0 p5 1 /int 3 p5 5 /cntr 1 p4 6 /s clk p4 5 /t x d p5 0 /int 2 p4 7 /s rdy /s out p4 4 /r x d seg 1 seg 2 seg 3 seg 4 seg 6 seg 5 seg 7 seg 0 seg 8 seg 9 com 2 com 1 com 0 v l3 v l2 v l1 v ref av ss p6 1 /an 1 p6 2 /an 2 p6 3 /an 3 p6 4 /an 4 p6 5 /an 5 p6 6 /an 6 p6 7 /an 7 seg 11 p3 4 /seg 12 m3823xgx-xxxhp m3823xgxhp p2 7 /kw 7 p2 6 /kw 6 p2 5 /kw 5 p2 4 /kw 4 p2 3 /kw 3 p2 2 /kw 2 p2 1 /kw 1 p2 0 /kw 0 fig. 1 m3823xgx-xxxfp pin configuration pin configuration (top view) package code : prqp0080gb-a (80p6n-a) (80-pin plastic-molded qfp) s e g 8 s e g 9 p 3 4 / s e g 1 2 p 3 5 / s e g 1 3 p 0 0 / s e g 1 6 p 0 3 / s e g 1 9 p 0 4 / s e g 2 0 p 0 5 / s e g 2 1 p 0 6 / s e g 2 2 p 0 7 / s e g 2 3 p 1 1 / s e g 2 5 p 1 2 / s e g 2 6 p 1 3 / s e g 2 7 p 1 4 / s e g 2 8 p 1 5 / s e g 2 9 p 1 6 / s e g 3 0 p 1 7 / s e g 3 1 v l 1 p 6 7 / a n 7 m 3 8 2 3 x g x - x x x f p m 3 8 2 3 x g x f p p 5 7 / a d t p 5 0 / i n t 2 p 4 6 / s c l k p 4 5 / t x d p 4 3 / i n t 1 p 4 2 / i n t 0 a v s s v r e f v c c s e g 0 p4 1 / p4 0 x in x out v ss p2 7 /kw 7 p2 6 /kw 6 p2 5 /kw 5 p2 4 /kw 4 p2 3 /kw 3 p2 2 /kw 2 p2 1 /kw 1 p 2 0 / k w 0 r e s e t p 5 1 / i n t 3 p 5 5 / c n t r 1 p 5 4 / c n t r 0 p 5 3 / r t p 1 p 5 2 / r t p 0 p 5 6 / t o u t p 1 0 / s e g 2 4 p 0 1 / s e g 1 7 p 0 2 / s e g 1 8 p 4 7 / s r d y / s o u t s e g 1 0 s e g 1 1 p 3 6 / s e g 1 4 p 3 7 / s e g 1 5 p 7 0 / x c o u t p 7 1 / x c i n c o m 0 v l 3 p 6 6 / a n 6 p 6 5 / a n 5 p 6 4 / a n 4 p 6 3 / a n 3 p 6 2 / a n 2 p 6 1 / a n 1 p 6 0 / a n 0 v l 2 c o m 1 c o m 2 c o m 3 seg 1 s e g 2 s e g 3 s e g 4 s e g 5 s e g 6 s e g 7 p 4 4 / r x d 1 23 4 567891 01 112 1 314151 6171 81920 2 122 2 32 4 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 6 5 6 6 6 7 6 8 6 9 7 0 7 1 7 2 7 3 7 4 7 5 7 6 7 7 7 8 7 9 8 0
rev.2.02 jun 19, 2007 page 3 of 73 rej03b0146-0202 3823 group t able 1 performance overview parameter 71 0.4 s (minimum instruction, f(x in ) 10 mhz, high-speed mode) 10 mhz (maximum) 16 k to 60 k bytes 640 to 2560 bytes 4-bit ? 1, 1-bit ? 1 (4 pins sharing seg) 8-bit ? 5, 7-bit ? 1, 2 bit ? 1 (16 pins sharing seg) 17 sources, 16 vectors (includes key input interrupt) 8-bit ? 3, 16-bit ? 2 8-bit ? 1 (uart or clock-synchronized) 10-bit ? 8 channels or 8 bit ? 8 channels 8-bit ? 1 32 bytes ? 2 blocks 1/2, 1/3 2, 3, 4 4 32 built-in feedback resistor (connect to external ceramic rasonator or quartz-crystal oscillator) built-in feedback resistor (connect to external quartz-crystal oscillator or on-chip oscillator) 4.5 to 5.5v 4.0 to 5.5v 2.5 to 5.5v 2.0 to 5.5v 1.8 to 5.5v 2.5 to 5.5v 2.0 to 5.5v 1.8 to 5.5v 1.8 to 5.5v std. 18 mw (vcc = 5v, f(x in ) = 8mhz, ta = 25 ?) std. 18 w (vcc = 2.5v, f(x in ) = stopped, f(x cin ) = 32khz, ta = 25 ?) std. 35 w (vcc = 2.5v, f(x in ) = stopped, f(x cin ) = stopped, ta = 25 ?) v cc 10ma -20 to 85 ? cmos sillicon gate 80-pin plastic molded lqfp/qfp number of basic instructions instruction execution time oscillation frequency memory sizes rom ram input port p3 4 -p3 7 , p4 0 i/o port p0-p2, p4 1 -p4 7 , p5, p6, p7 0 , p7 1 interrupt t imer serial interface a/d converter w atchdog timer rom correction function lcd drive control bias circuit duty common output segment output main clock generating circuits sub-clock generating circuits power source voltage in frequency/2 mode (f(x in ) 10mhz) in frequency/2 mode (f(x in ) 8mhz) in frequency/4 mode (f(x in ) 10mhz) in frequency/4 mode (f(x in ) 8mhz) in frequency/4 mode (f(x in ) 5mhz) in frequency/8 mode (f(x in ) 10mhz) in frequency/8 mode (f(x in ) 8mhz) in frequency/8 mode (f(x in ) 5mhz) in low-speed mode power dissipation in frequency/2 mode in low-speed mode at x cin in low-speed mode at on-chip oscillator input/output input/output withstand voltage characteristics output current operating temperature range device structure package function
rev.2.02 jun 19, 2007 page 4 of 73 rej03b0146-0202 3823 group functional block diagram (package type : plqp0080kb-a) fig. 3 functional block diagram k e y o n w a k e u p r e a l t i m e p o r t f u n c t i o n i n t 2 , i n t 3 c n t r 0 , c n t r 1 t o u t a d t i n t 0 , i n t 1 , x c i n r t p 0 , r t p 1 d a t a b u s c p u a x y s p c h p c l p s r e s e t v c c v s s r e s e t i n p u t ( 5 v ) ( 0 v ) r o m r a m l c d d i s p l a y r a m ( 1 6 b y t e s ) 2 5 7 1 3 0 i / o p o r t p 5 p 4 ( 8 ) i / o p o r t p 4 i / o p o r t p 2 p 2 ( 8 ) i / o p o r t p 0 p 0 ( 8 ) i / o p o r t p 1 p 1 ( 8 ) p 6 ( 8 ) i n p u t p o r t p 3 p 3 ( 4 ) i / o p o r t p 6 p 5 ( 8 ) i / o p o r t p 7 p 7 ( 2 ) 8 0 7 9 7 8 7 7 7 6 7 5 7 4 7 0 6 9 6 8 6 7 6 6 6 5 6 4 6 3 6 2 6 1 6 0 5 9 4 7 4 8 4 9 5 0 5 1 5 2 5 3 5 4 3 9 4 0 4 1 4 2 4 3 4 4 4 5 4 6 3 1 3 2 3 3 3 4 3 5 3 6 3 7 3 8 5 5 5 6 5 7 5 8 1 9 2 0 2 1 2 2 2 3 2 4 1 7 1 8 2 6 2 7 1 2 3 4 5 6 7 8 7 3 7 2 1 0 1 1 1 2 1 3 1 4 1 5 1 6 9 c l o c k g e n e r a t i n g c i r c u i t m a i n c l o c k i n p u t x i n m a i n c l o c k o u t p u t x o u t x c o u t s u b - c l o c k o u t p u t x c i n s u b - c l o c k i n p u t s i / o ( 8 ) v r e f a v s s ( 0 v ) a / d c o n v e r t e r ( 1 0 / 8 ) t i m e r x ( 1 6 ) t i m e r y ( 1 6 ) t i m e r 1 ( 8 ) t i m e r 2 ( 8 ) t i m e r 3 ( 8 ) l c d d r i v e c o n t r o l c i r c u i t v l 1 v l 2 v l 3 c o m 0 c o m 1 c o m 2 c o m 3 s e g 0 s e g 1 s e g 2 s e g 3 s e g 4 s e g 5 s e g 6 s e g 7 s e g 8 s e g 9 s e g 1 0 s e g 1 1 x c i n x c o u t 2 8 2 9 o n - c h i p o s c i l l a t o r r o m c o r r e c t i o n f u n c t i o n w a t c h d o g t i m e r r e s e t
rev.2.02 jun 19, 2007 page 5 of 73 rej03b0146-0202 3823 group pin description ta ble 2 pin description (1) v cc , v ss function pin name function except a port function ?cd segment output pins power source apply voltage of power source to v cc , and 0 v to v ss . (for the limits of v cc , refer to ?ecom- mended operating conditions?. v ref av ss reset x in x out v l1 ? l3 com 0 ?om 3 seg 0 ?eg 11 p0 0 /seg 16 p0 7 /seg 23 p1 0 /seg 24 p1 7 /seg 31 p2 0 /kw 0 p2 7 /kw 7 p3 4 /seg 12 p3 7 /seg 15 analog refer- ence voltage analog power source reset input clock input clock output lcd power source common output segment output i/o port p0 i/o port p1 i/o port p2 ?eference voltage input pin for a/d converter. ?nd input pin for a/d converter. ?onnect to v ss . ?eset input pin for active ?? ?nput and output pins for the main clock generating circuit. ?eedback resistor is built in between x in pin and x out pin. ?onnect a ceramic resonator or a quartz-crystal oscillator between the x in and x out pins to set the oscillation frequency. ?f an external clock is used, connect the clock source to the x in pin and leave the x out pin open. this clock is used as the oscillating source of system clock. input 0 v l1 v l2 v l3 voltage. ?nput 0 ?v l3 voltage to lcd. ?cd common output pins. ?om 2 and com 3 are not used at 1/2 duty ratio. ?om 3 is not used at 1/3 duty ratio. ?cd segment output pins. ?-bit i/o port. ?mos compatible input level. ?mos 3-state output structure. i/o direction register allows each port to be individually programmed as either input or output. ?ull-down control is enabled. ?-bit i/o port. ?mos compatible input level. ?mos 3-state output structure. i/o direction register allows each pin to be individually programmed as either input or output. ?ull-up control is enabled. ?-bit input port. ?mos compatible input level. ?ull-down control is enabled. key input (key-on wake-up) interrupt input pins lcd segment output pins input port p3
rev.2.02 jun 19, 2007 page 6 of 73 rej03b0146-0202 3823 group tabl e 3 pin description (2) function pin function except a port function p4 0 p4 2 /int 0 , p4 3 /int 1 p4 4 /r x d, p4 5 /t x d, p4 6 /s clk , p4 7 /s rdy /s out p5 0 /int 2 , p5 1 /int 3 p5 2 /rtp 0 , p5 3 /rtp 1 p5 4 /cntr 0 , p5 5 /cntr 1 p5 6 /t out p5 7 /adt p6 0 /an 0 p6 7 /an 7 p7 0 /x cout, p7 1 /x cin ?-bit input port. ?mos compatible input level. ?-bit i/o port. ?mos compatible input level. ?mos 3-state output structure. i/o direction register allows each pin to be individually programmed as either input or output. ?ull-up control is enabled. ?-bit i/o port. ?mos compatible input level. ?mos 3-state output structure. i/o direction register allows each pin to be individually programmed as either input or output. ?ull-up control is enabled. ?-bit i/o port. ?mos compatible input level. ?mos 3-state output structure. i/o direction register allows each pin to be individually programmed as either input or output. ?ull-up control is enabled. 2-bit i/o port. cmos compatible input level. cmos 3-state output structure. i/o direction register allows each pin to be individually programmed as either input or output. pull-up control is enabled. clock output pin ?nterrupt input pins ?nterrupt input pins real time port function pins ? imer x, y function pins ? imer 2 output pins ? /d conversion input pins sub-clock generating circuit i/o pins. (connect a resonator. external clock cannot be used.) p4 1 / serial interface function pins a/d trigger input pins name i/o port p4 i/o port p5 i/o port p6 i/o port p7 input port p4 ?zrom program power pin
rev.2.02 jun 19, 2007 page 7 of 73 rej03b0146-0202 3823 group p art numbering fig. 4 part numbering package code fp : prqp0080gb-a package hp : plqp0080kb-a package rom number omitted in the shipped in blank version. rom/prom size 1 : 4096 bytes 2 : 8192 bytes 3 : 12288 bytes 4 : 16384 bytes 5 : 20480 bytes 6 : 24576 bytes 7 : 28672 bytes 8 : 32768 bytes the first 128 bites and the last 2 bytes of rom are reserved areas ; they cannot be used. memory type g : qzrom version ram size 0 : 192 bytes 1 : 256 bytes 2 : 384 bytes 3 : 512 bytes 4 : 640 bytes 5 : 768 bytes 6 : 896 bytes 7 : 1024 bytes 8 : 1536 bytes 9 : 2048 bytes a : 2560 bytes product m3823 4 g 6 -xxx fp 9 : 36864 bytes a : 40960 bytes b : 45056 bytes c : 49152 bytes d : 53248 bytes e : 57344 bytes f : 61440 bytes
rev.2.02 jun 19, 2007 page 8 of 73 rej03b0146-0202 3823 group group expansion mitsubishi plans to expand the 3823 group as follows: memory type support for qzrom version. memory size rom size ........................................................... 16 k to 60 k bytes ram size ............................................................ 640 to 2560 bytes package prqp0080gb-a ........................ 0.8 mm-pitch plastic molded qfp plqp0080kb-a ....................... 0.5 mm-pitch plastic molded lqfp memory expansion plan fig. 5 memory expansion plan 32k 28k 24k 20k 16k 12k 8k 4k 256 384 512 640 768 896 1,024 192 40k 48k 1,536 2,048 56k 60k rom size (bytes) ram size (bytes) 2,560 m3823agf mass production m38239gc m38238g8 mass production mass production m38235g6 m38234g4 mass production mass production
rev.2.02 jun 19, 2007 page 9 of 73 rej03b0146-0202 3823 group currently products are listed below. remarks package part no. ram size (bytes) 61440 (61310) 49152 (49022) 32768 (32638) 24576 (24446) 16384 (16254) rom size (bytes) rom size for user in ( ) t able 4 list of products m3823agf-xxxfp m3823agf-xxxhp m3823agffp m3823agfhp m38239gc-xxxfp m38239gc-xxxhp m38239gcfp m38239gchp m38238g8-xxxfp m38238g8-xxxhp m38238g8fp m38238g8hp m38235g6-xxxfp m38235g6-xxxhp m38235g6fp m38235g6hp m38234g4-xxxfp m38234g4-xxxhp m38234g4fp m38234g4hp 2560 (note 1) 2048 (note 2) 1536 (note 2) 768 (note 2) 640 (note 2) prqp0080gb-a plqp0080kb-a prqp0080gb-a plqp0080kb-a prqp0080gb-a plqp0080kb-a prqp0080gb-a plqp0080kb-a prqp0080gb-a plqp0080kb-a prqp0080gb-a plqp0080kb-a prqp0080gb-a plqp0080kb-a prqp0080gb-a plqp0080kb-a prqp0080gb-a plqp0080kb-a prqp0080gb-a plqp0080kb-a blank blank blank blank blank blank blank blank blank blank note 1: ram size includes ram for lcd display and rom corrections. note 2: ram size includes ram for lcd display.
rev.2.02 jun 19, 2007 page 10 of 73 rej03b0146-0202 3823 group functional description central processing unit (cpu) the 3823 group uses the standard 740 family instruction set. re- fer to the table of 740 family addressing modes and machine instructions or the 740 family software manual for details on the instruction set. machine-resident 740 family instructions are as follows: the fst and slw instruction cannot be used. the stp, wit, mul, and div instruction can be used. the central processing unit (cpu) has six registers. figure 6 shows the 740 family cpu register structure. [accumulator (a)] the accumulator is an 8-bit register. data operations such as data transfer, etc., are executed mainly through the accumulator. [index register x (x)] the index register x is an 8-bit register. in the index addressing modes, the value of the operand is added to the contents of register x and specifies the real address. [index register y (y)] the index register y is an 8-bit register. in partial instruction, the value of the operand is added to the contents of register y and specifies the real address. [stack pointer (s)] the stack pointer is an 8-bit register used during subroutine calls and interrupts. this register indicates start address of stored area (stack) for storing registers during subroutine calls and interrupts. the low-order 8 bits of the stack address are determined by the contents of the stack pointer. the high-order 8 bits of the stack ad- dress are determined by the stack page selection bit. if the stack page selection bit is ??, the high-order 8 bits becomes ?0 16 ? if the stack page selection bit is ?? the high-order 8 bits becomes ?1 16 ? the operations of pushing register contents onto the stack and popping them from the stack are shown in figure 7. store registers other than those described in table 4 with program when the user needs them during interrupts or subroutine calls. [program counter (pc)] the program counter is a 16-bit counter consisting of two 8-bit registers pc h and pc l . it is used to indicate the address of the next instruction to be executed. fig. 6 740 family cpu register structure a accumulator b7 b7 b7 b7 b0 b7 b15 b0 b7 b0 b0 b0 b0 x index register x y index register y s stack pointer pc l program counter pc h n vtb di zc processor status register (ps) carry flag zero flag interrupt disable flag decimal mode flag break flag index x mode flag overflow flag negative flag
rev.2.02 jun 19, 2007 page 11 of 73 rej03b0146-0202 3823 group t able 5 push and pop instructions of accumulator or processor status register accumulator processor status register push instruction to stack pha php pop instruction from stack pla plp fig. 7 register push and pop at interrupt generation and subroutine call n o t e : c o n d i t i o n f o r a c c e p t a n c e o f a n i n t e r r u p t i n t e r r u p t e n a b l e f l a g i s 1 e x e c u t e j s r o n - g o i n g r o u t i n e m ( s )( p c h ) ( s ) ( s ) 1 m ( s )( p c l ) e x e c u t e r t s ( p c l )m ( s ) ( s ) ( s ) 1 ( s ) ( s ) + 1 ( s ) ( s ) + 1 ( p c h )m ( s ) s u b r o u t i n e p o p re t u r n a d d r e s s f r o m s t a c k p u s h r e t u r n a d d r e s s o n s t a c k m ( s )( p s ) e x e c u t e r t i ( p s )m ( s ) ( s ) ( s ) 1 ( s ) ( s ) + 1 i n t e r r u p t s e r v i c e r o u t i n e p o p c o n t e n t s o f p r o c e s s o r s t a t u s r e g i s t e r f r o m s t a c k m ( s )( p c h ) ( s ) ( s ) e 1 m ( s )( p c l ) ( s ) ( s ) e 1 ( p c l )m ( s ) ( s ) ( s ) + 1 ( s ) ( s ) + 1 ( p c h )m ( s ) p o p r e t u r n a d d r e s s f r o m s t a c k i f l a g i s s e t f r o m 0 t o 1 f e t c h t h e j u m p v e c t o r p u s h r e t u r n a d d r e s s o n s t a c k p u s h c o n t e n t s o f p r o c e s s o r s t a t u s r e g i s t e r o n s t a c k i n t e r r u p t r e q u e s t ( n o t e ) i n t e r r u p t d i s a b l e f l a g i s 0
rev.2.02 jun 19, 2007 page 12 of 73 rej03b0146-0202 3823 group [processor status register (ps)] the processor status register is an 8-bit register consisting of 5 flags which indicate the status of the processor after an arithmetic operation and 3 flags which decide mcu operation. branch opera- tions can be performed by testing the carry (c) flag , zero (z) flag, overflow (v) flag, or the negative (n) flag. in decimal mode, the z, v, n flags are not valid. ?it 0: carry flag (c) the c flag contains a carry or borrow generated by the arithmetic logic unit (alu) immediately after an arithmetic operation. it can also be changed by a shift or rotate instruction. ?it 1: zero flag (z) the z flag is set if the result of an immediate arithmetic operation or a data transfer is ?? and cleared if the result is anything other than ?? ?it 2: interrupt disable flag (i) the i flag disables all interrupts except for the interrupt generated by the brk instruction. interrupts are disabled when the i flag is ?? ?it 3: decimal mode flag (d) the d flag determines whether additions and subtractions are executed in binary or decimal. binary arithmetic is executed when this flag is ?? decimal arithmetic is executed when it is ?? decimal correction is automatic in decimal mode. only the adc and sbc instructions can be used for decimal arithmetic. ?it 4: break flag (b) the b flag is used to indicate that the current interrupt was generated by the brk instruction. the brk flag in the processor status register is always ?? when the brk instruction is used to generate an interrupt, the processor status register is pushed onto the stack with the break flag set to ?? ?it 5: index x mode flag (t) when the t flag is ?? arithmetic operations are performed between accumulator and memory. when the t flag is ?? direct arithmetic operations and direct data transfers are enabled between memory locations. ?it 6: overflow flag (v) the v flag is used during the addition or subtraction of one byte of signed data. it is set if the result exceeds +127 to -128. when the bit instruction is executed, bit 6 of the memory location operated on by the bit instruction is stored in the overflow flag. ?it 7: negative flag (n) the n flag is set if the result of an arithmetic operation or data transfer is negative. when the bit instruction is executed, bit 7 of the memory location operated on by the bit instruction is stored in the negative flag. t able 6 set and clear instructions of each bit of processor status register set instruction clear instruction c flag sec clc z flag i flag sei cli d flag sed cld b flag t flag set clt v flag clv n flag
rev.2.02 jun 19, 2007 page 13 of 73 rej03b0146-0202 3823 group [cpu mode register (cpum)] 003b 16 the cpu mode register contains the stack page selection bit and the internal system clock selection bit. the cpu mode register is allocated at address 003b 16 . fig. 8 structure of cpu mode register not available processor mode bits b1 b0 0 0 : single-chip mode 0 1 : 1 0 : 1 1 : stack page selection bit 0 : 0 page 1 : 1 page not used (returns ??when read) (do not write ??to this bit) port x c switch bit (note 1) 0 : i/o port function (stop oscillating) 1 : x cin ? cout oscillating function main clock (x in x out ) stop bit (note 2) 0 : oscillating 1 : stopped main clock division ratio selection bit 0 : f(x in )/2 (frequency/2 mode), or f(x in )/4 (frequency/4 mode) (note 3) 1 : f(x in )/8 (frequency/8 mode) internal system clock selection bit 0 : x in ? out selected (frequency/2/4/8 mode) 1 : x cin ? cout, or on-chip oscillator selected (low-speed mode) (note 4) cpu mode register (cpum (cm) : address 003b 16 ) b7 b0 note 1: in low speed mode (x cin is selected as the system clock ), x cin -x cout oscillation does not stop even if the port x c switch bit is set to "0". 2: in frequency/2/4/8 mode, x in -x out oscillation does not stop even if the main clock (x in -x out ) stop bit is set to "1". 3: when the system clock is divided by 4 of f(x in ), set the bit 6 in the cpu mode register to ??after setting the bit 1 in the cpu mode extension register to ?? 4: when using the on-chip oscillator in low-speed mode, set the bit 7 in the cpu mode register to ??after setting the bit 0 in the cpu mode extension register to ?? [cpu mode extension register (expcm)] 002b 16 f(x in ) divided by 4 for the system clock f and the on-chip oscillator for the system clock f in low-speed mode can be selected by set- ting the cpu mode extension register. when the system clock f is divided by 4 of f(x in ), set the bit 6 in the cpu mode register to ? after setting the bit 1 in the cpu mode extension register to ?? when using the on-chip oscillator in low-speed mode, set the bit 7 in the cpu mode register to ??after setting the bit 0 in the cpu mode extension register to ?? fig. 9 structure of cpu mode extension register on-chip oscillator control bit 0 : on-chip oscillator not used (on -chip oscillator sotpping) 1 : on-chip oscillator used (note 1) (on -chip oscillator oscillating) frequency/4 mode control bit (note 2) 0 : frequency/2 mode = f(x in )/2 1 : frequency/4 mode = f(x in )/4 not used (returns ??when read) (do not write ??to this bit) cpu mode extension register (expcm : address 002b 16 ) b7 b0 1 : the on-chip oscillator is selected for the operation clock in low-speed mod regardless of x cin -x cout . 2 : valid only when the main clock division ratio selection bit (bit 6 in the cpu mode register) is set to "0". when "1" (frequency/8 mode) is selected for the main clock division ratio selection bit or when the internal system clock selection bit is set to 1, set "0" to the frequency/4 mode control bit. note
rev.2.02 jun 19, 2007 page 14 of 73 rej03b0146-0202 3823 group memory special function register (sfr) area the special function register area in the zero page contains con- trol registers such as i/o ports and timers. ram ram is used for data storage and for stack area of subroutine calls and interrupts. rom the first 128 bytes and the last 2 bytes of rom are reserved for device testing and the rest is user area for storing programs. interrupt vector area the interrupt vector area contains reset and interrupt vectors. zero page the 256 bytes from addresses 0000 16 to 00ff 16 are called the zero page area. the internal ram and the special function regis- ter (sfr) are allocated to this area. the zero page addressing mode can be used to specify memory and register addresses in the zero page area. access to this area with only 2 bytes is possible in the zero page addressing mode. special page the 256 bytes from addresses ff00 16 to ffff 16 are called the special page area. the special page addressing mode can be used to specify memory addresses in the special page area. access to this area with only 2 bytes is possible in the special page addressing mode. fig. 10 memory map diagram 6 4 0 7 6 8 1 5 3 6 2 0 4 8 2 5 6 0 0 2 b f 1 6 0 3 3 f 1 6 0 6 3 f 1 6 0 8 3 f 1 6 0 a3 f 1 6 ram area r a m s i z e ( b y t e s ) a d d r e s s x x x x 1 6 1 6 3 8 4 2 4 5 7 6 3 2 7 6 8 4 9 1 5 2 6 1 4 4 0 c 0 0 0 1 6 a 0 0 0 1 6 8 0 0 0 1 6 4 0 0 0 1 6 10 0 0 1 6 c 0 8 0 1 6 a 0 8 0 1 6 8 0 8 0 1 6 4 0 8 0 1 6 10 8 0 1 6 r o m a r e a r o m s i z e ( b y t e s ) a d d r e s s y y y y 1 6 a d d r e s s z z z z 1 6 0100 16 0000 16 0040 16 0 a 40 16 ff 00 16 f f d c 1 6 fffe 16 ffff 16 xxxx 16 zzzz 16 ram r o m ram f or rom correct i on sfr area n o t u s e d i nterrupt vector area r e s e r v e d r o m a r e a z ero page s p e c i a l p a g e r e s e r v e d r o m a r e a 0050 16 lcd di sp l ay ram area r a m 1 f o r r o m c o r r e c t i o n r a m 2 f o r r o m c o r r e c t i o n 0 a 00 16 0 a 1 f 16 0 a 2 0 1 6 0 a 3 f 1 6 y y y y 1 6 rom code protect address ?0 16 ?is written into rom code protect address (other than the user rom area) when selecting the protect bit write by using a se- rial programmer or selecting protect enabled for writing shipment by renesas technology corp.. when ?0 16 ?is set to the rom code protect address, the protect function is enabled, so that read- ing or writing from/to qzrom is disabled by a serial programmer. as for the qzrom product in blank, the rom code is protected by selecting the protect bit write at rom writing with a serial pro- grammer. as for the qzrom product shipped after writing, ?0 16 ?(protect enabled) or ?f 16 ?(protect disabled) is written into the rom code protect address when renesas technology corp. performs writing. the writing of ?0 16 " or ?f 16 ?can be selected as rom option setup (?ask option?written in the mask file converter) when or- dering.
rev.2.02 jun 19, 2007 page 15 of 73 rej03b0146-0202 3823 group fig. 11 memory map of special function register (sfr) 0 0 2 0 1 6 0 0 2 1 1 6 0 0 2 2 1 6 0 0 2 3 1 6 0 0 2 4 1 6 0 0 2 5 1 6 0 0 2 6 1 6 0 0 2 7 1 6 0 0 2 8 1 6 0 0 2 9 1 6 0 0 2 a 1 6 0 0 2 b 1 6 002 c 16 002 d 16 002 e 16 0 0 2 f 1 6 0 0 3 0 1 6 0 0 3 1 1 6 0 0 3 2 1 6 0 0 3 3 1 6 0 0 3 4 1 6 0 0 3 5 1 6 0 0 3 6 1 6 0 0 3 7 1 6 0038 16 0039 16 003 a 16 0 0 3 b 1 6 003 c 16 003 d 16 003 e 16 0 0 3 f 1 6 0 0 0 0 1 6 0 0 0 1 1 6 0 0 0 2 1 6 0 0 0 3 1 6 0 0 0 4 1 6 0 0 0 5 1 6 0 0 0 6 1 6 0 0 0 7 1 6 0 0 0 8 1 6 0 0 0 9 1 6 0 0 0 a 1 6 0 0 0 b 1 6 0 0 0 c 1 6 0 0 0 d 1 6 000 e 16 0 0 0 f 1 6 0 0 1 0 1 6 0 0 1 1 1 6 0 0 1 2 1 6 0 0 1 3 1 6 0 0 1 4 1 6 0 0 1 5 1 6 0 0 1 6 1 6 0 0 1 7 1 6 0018 16 0019 16 001 a 16 0 0 1 b 1 6 0 0 1 c 1 6 001 d 16 001 e 16 0 0 1 f 1 6 i n t e r r u p t c o n t r o l r e g i s t e r 2 ( i c o n 2 ) t i m e r 3 r e g i s t e r ( t 3 ) t i m e r x m o d e r e g i s t e r ( t x m ) i nterrupt e d ge se l ect i on reg i ster (intedge) c p u m o d e r e g i s t e r ( c p u m ) i nterrupt r equest reg i ster 1 (ireq 1 ) i nterrupt r equest reg i ster 2 (ireq 2 ) i n t e r r u p t c o n t r o l r e g i s t e r 1 ( i c o n 1 ) t i m e r x l o w - o r d e r r e g i s t e r ( t x l ) t i m e r y l o w - o r d e r r e g i s t e r ( t y l ) t i m e r 1 r e g i s t e r ( t 1 ) t i m e r 2 r e g i s t e r ( t 2 ) t i m e r x h i g h - o r d e r r e g i s t e r ( t x h ) t i m e r y h i g h - o r d e r r e g i s t e r ( t y h ) t i m e r y m o d e r e g i s t e r ( t y m ) ti mer 123 mo d e reg i ster (t 123 m) output contro l reg i ster (ckout) s e g m e n t o u t p u t e n a b l e r e g i s t e r ( s e g ) lcd mo d e reg i ster (lm) a d c o n t r o l r e g i s t e r ( a d c o n ) a d c o n v e r s i o n h i g h - o r d e r r e g i s t e r ( a d h ) p o r t p 0 r e g i s t e r ( p 0 ) p o r t p 1 r e g i s t e r ( p 1 ) p o r t p 1 d i r e c t i o n r e g i s t e r ( p 1 d ) p o r t p 2 r e g i s t e r ( p 2 ) p o r t p 2 d i r e c t i o n r e g i s t e r ( p 2 d ) p o r t p 3 r e g i s t e r ( p 3 ) p o r t p 4 r e g i s t e r ( p 4 ) p o r t p 4 d i r e c t i o n r e g i s t e r ( p 4 d ) p o r t p 5 r e g i s t e r ( p 5 ) p o r t p 5 d i r e c t i o n r e g i s t e r ( p 5 d ) p o r t p 6 r e g i s t e r ( p 6 ) p o r t p 6 d i r e c t i o n r e g i s t e r ( p 6 d ) p o r t p 7 r e g i s t e r ( p 7 ) p o r t p 7 d i r e c t i o n r e g i s t e r ( p 7 d ) s e r i a l i / o s t a t u s r e g i s t e r ( s i o s t s ) s er i a l i / o c ontro l reg i ster (sio 1 con) uart contro l reg i ster (uartcon) b au d rate generator (brg) p u l l r e g i s t e r a ( p u l l a ) p u l l r e g i s t e r b ( p u l l b ) t r a n s m i t / r e c e i v e b u f f e r r e g i s t e r ( t b / r b ) p o r t p 0 d i r e c t i o n r e g i s t e r ( p 0 d ) r o m c o r r e c t i o n a d d r e s s 1 h i g h - o r d e r r e g i s t e r ( r c a 1 h ) r o m c o r r e c t i o n a d d r e s s 1 l o w - o r d e r r e g i s t e r ( r c a 1 l ) r o m c o r r e c t i o n a d d r e s s 2 h i g h - o r d e r r e g i s t e r ( r c a 2 h ) r o m c o r r e c t i o n a d d r e s s 2 l o w - o r d e r r e g i s t e r ( r c a 2 l ) r o m c o r r e c t i o n e n a b l e r e g i s t e r ( r c r ) t e m p o r a r y d a t a r e g i s t e r 0 ( t d 0 ) t e m p o r a r y d a t a r e g i s t e r 1 ( t d 1 ) c p u m o d e e x p a n s i o n r e g i s t e r ( e x p c m ) t e m p o r a r y d a t a r e g i s t e r 2 ( t d 2 ) rrf reg i ster ( rrfr) p er i p h era l f unct i on expans i on reg i ster ( exp) a d c o n v e r s i o n l o w - o r d e r r e g i s t e r ( a d l ) w atc hd og t i mer reg i ster (wdt) n o t e : d o n o t a c c e s s t o t h e s f r a r e a i n c l u d i n g n o t h i n g .
rev.2.02 jun 19, 2007 page 16 of 73 rej03b0146-0202 3823 group i/o ports direction registers (ports p2, p4 1 -p4 7 , and p5-p7) the 3823 group has 49 programmable i/o pins arranged in seven i/o ports (ports p0?2, p4 1 ?4 7 and p5-p7). the i/o ports p2, p4 1 ?4 7 and p5-p7 have direction registers which determine the input/output direction of each individual pin. each bit in a direction register corresponds to one pin, and each pin can be set to be in- put port or output port. when ??is written to the bit corresponding to a pin, that pin be- comes an input pin. when ??is written to that bit, that pin be- comes an output pin. if data is read from a pin set to output, the value of the port output latch is read, not the value of the pin itself. pins set to input are floating. if a pin set to input is written to, only the port output latch is written to and the pin remains floating. direction registers (ports p0 and p1) ports p0 and p1 have direction registers which determine the in- put/output direction of each individual port. each port in a direction register corresponds to one port, each port can be set to be input or output. when ??is written to the bit 0 of a direction register, that port becomes an input port. when ??is written to that port, that port becomes an output port. bits 1 to 7 of ports p0 and p1 direction registers are not used. ports p3 and p4 0 these ports are only for input. pull-up/pull-down control by setting the pull register a (address 0016 16 ) or the pull reg- ister b (address 0017 16 ), ports except for port p4 0 can control either pull-down or pull-up (pins that are shared with the segment output pins for lcd are pull-down; all other pins are pull-up) with a program. however, the contents of pull register a and pull register b do not affect ports programmed as the output ports. fig. 12 structure of pull register a and pull register b p 0 0 p 0 7 pu ll - d own p1 0 ?1 7 pull-down p2 0 ?2 7 pull-up p3 4 ?3 7 pull-down p7 0 , p7 1 pull-up not used (return ??when read) pull reg i ster a (pulla: address 0016 16 ) b 7 b 0 p 4 1 p 4 3 pu ll -up p4 4 ?4 7 pull-up p5 0 ?5 3 pull-up p5 4 ?5 7 pull-up p6 0 ?6 3 pull-up p6 4 ?6 7 pull-up not used (return ??when read) 0 : d i s a b l e 1 : e n a b l e pull reg i ster b (pullb : address 0017 16 ) b 7 b 0 n ote : th e contents o f pull reg i ster a an d pull reg i ster b do not affect ports programmed as the output port.
rev.2.02 jun 19, 2007 page 17 of 73 rej03b0146-0202 3823 group real time port function output a/d conversion input a/d trigger input diagram no. related sfrs input/output name pin non-port function i/o format t able 7 list of i/o port function p0 0 /seg 16 p0 7 /seg 23 p1 0 /seg 24 p1 7 /seg 31 p2 0 /kw 0 p2 7 /kw 7 p3 4 /seg 12 p3 7 /seg 15 p4 0 p4 1 / p4 2 /int 0, p4 3 /int 1 p4 4 /r x d p4 5 /t x d p4 6 /s clk p4 7 /s rdy /s out p5 0 /int 2 , p5 1 /int 3 p5 2 /rtp 0 , p5 3 /rtp 1 p5 4 /cntr 0 port p0 port p1 port p2 port p3 port p4 input/output, individual ports input/output, individual bits input input input/output, individual bits cmos compatible input level cmos 3-state output cmos compatible input level cmos 3-state output cmos compatible input level cmos compatible input level cmos compatible input level cmos 3-state output cmos compatible input level cmos 3-state output cmos compatible input level cmos 3-state output cmos compatible input level cmos 3-state output lcd segment output key input (key-on wake-up) interrupt input lcd segment output clock output x cin frequency signal output external interrupt input serial i/o function input/output external interrupt input t imer x function i/o t imer y function input ti mer 2 function output pull register a segment output enable register pull register a interrupt control register 2 pull register a segment output enable register pull register b output control register peripheral function extension register pull register b interrupt edge selection register pull register b serial i/o control register serial i/o status register uart control register peripheral function extension register pull register b interrupt edge selection register pull register b t imer x mode register pull register b t imer x mode register pull register b ti mer y mode register pull register b ti mer 123 mode register pull register b a/d control register pull register a cpu mode register (1) (2) (3) (4) (6) (5) (2) (8) (7) port p5 (9) (2) input/output, individual bits (10) p5 5 /cntr 1 (11) (12) (13) (12) (14) p5 6 /t out p5 7 /adt p6 0 /an 0 p6 7 /an 7 (15) p7 0 /x cout p7 1 /x cin com 0 ?om 3 seg 0 ?eg 11 (16) (17) (18) input/output, individual bits input/output, individual bits output output sub-clock generating circuit i/o lcd common output lcd segment output port p6 port p7 common segment lcd mode register notes 1: for details of how to use double function ports as function i/o ports, refer to the applicable sections. 2: when an input level is at an intermediate potential, a current will flow from v cc to v ss through the input-stage gate. especially, power source current may increase during execution of the stp and wit instructions. fix the unused input pins to ??or ??through a resistor. qzrom program power pin
rev.2.02 jun 19, 2007 page 18 of 73 rej03b0146-0202 3823 group fig. 13 port block diagram (1) ( 3 ) p o r t s p 3 4 p 3 7 v l 2 / v l 3 v l1 /v ss s e g m e n t o u t p u t e n a b l e b i t v l 2 / v l 3 v l 1 / v s s ( n o t e ) ( 2 ) p o r t s p 2 , p 4 2 , p 4 3 , p 5 0 , p 5 1 d i r e c t i o n r e g i s t e r (5) port p4 1 ( 6 ) p o r t p 4 4 r e c e i v e e n a b l e b i t direction register ( 4 ) p o r t p 4 0 d a t a b u s pull-down control s e g m e n t o u t p u t e n a b l e b i t d a t a b u s d i r e c t i o n r e g i s t e r p o r t l a t c h p u l l - d o w n c o n t r o l segment output enable bit data bus port latch pull-up control ke y input (key-on wake-up) interrupt input int 0 ?nt 3 interrupt input pull-up control serial i/o enable bit serial i/o input data bus port latch (1) ports p0, p1 n o t e : b i t 0 o f d i r e c t i o n r e g i s t e r . data bus q z rom pr ogrammable power source o u t p u t c o n t r o l b i t port latch d a t a b u s d i r e c t i o n r e g i s t e r pull-up control x cin fr equency signal o u t p u t c l o c k s e l e c t i o n b i t
rev.2.02 jun 19, 2007 page 19 of 73 rej03b0146-0202 3823 group fig. 14 port block diagram (2) ( 7 ) p o r t p 4 5 ( 8 ) p o r t p 4 6 serial i/o clock- synchronized selection bit serial i /o en able bit serial i/o mode se lection bit serial i /o en able bit direction register port latch s e r i a l i / o c l o c k o u t p u t d a t a b u s s e r i a l i / o c l o c k i n p u t p u l l - u p c o n t r o l (10) ports p5 2, p5 3 direction register port latch data bus pull-up control r e a l t i m e p o r t c o n t r o l b i t d a t a f o r r e a l t i m e p o r t direction register port latch d a t a b u s pull-up control ( 1 2 ) p o r t s p 5 5 , p 5 7 cntr 1 in te rr upt input a/ d tr i gger interrupt input ( 1 1 ) p o r t p 5 4 d i r e c t i o n r e g i s t e r p o r t l a t c h d a t a b u s pull-up control t i m e r x o p e r a t i n g m o d e b i t t i m e r o u t p u t cntr 0 in te rr upt input (pulse output mode selection) d a t a b u s serial i/o enable bit transmit enable bit s e r i a l i / o o u t p u t ( s y n c h r o n o u s o r a s y n c h r o n o u s ) p-channel output disabled selection bit p o r t l a t c h d i r e c t i o n r e g i s t e r p u l l - u p c o n t r o l p 4 5 / t x d , p 4 7 / s r d y / s o u t p - c h a n n e l o u t p u t d i s a b l e b i t as y n c h r o n o u s s e r i a l i / o o u t p u t sy n c h r o n o u s s e r i a l i / o o u t p u t p i n s e l e c t i o n b i t d a t a b u s s e r i a l i / o r e a d y o u t p u t port latch serial i/o mode selection bit serial i/o enable bit s rdy ,s out output enable bit d i r e c t i o n r e g i s t e r pull-up control p-channel output disabled selection bit synchr onous serial i/o output pin selection bit synchronous serial i/o output p 4 5 / t x d , p 4 7 / s r d y / s o u t p - c h a n n e l o u t p u t d i s a b l e b i t (9) port p4 7
rev.2.02 jun 19, 2007 page 20 of 73 rej03b0146-0202 3823 group fig. 15 port block diagram (3) v l 2 / v l 3 v l 1 / v s s ( 1 3 ) p o r t p 5 6 d a t a b u s d i r e c t i o n r e g i s t e r p o r t l a t c h p u l - u p c o n t r o l t o u t o u t p u t c o n t r o l b i t t i m e r o u t p u t ( 1 4 ) p o r t p 6 data bus direction register port latch p u l l - u p c o n t r o l a / d c o n v e r s i o n i n p u t a n a l o g i n p u t p i n s e l e c t i o n b i t ( 1 5 ) p o r t p 7 0 d a t a b u s d i r e c t i o n r e g i s t e r p o r t l a t c h p o r t x c s w i t c h b i t + p u l l - u p c o n t r o l p o r t x c s w i t c h b i t o s c i l l a t i o n c i r c u i t p o r t p 7 1 p o r t x c s w i t c h b i t ( 1 6 ) p o r t p 7 1 d a t a b u s direction register port latch port x c switch bit p o r t x c s w i t c h b i t + p u l l - u p c o n t r o l s u b - c l o c k g e n e r a t i n g c i r c u i t i n p u t v l 3 v l 2 v l 1 ( 1 7 ) c o m 0 c o m 3 ( 1 8 ) s e g 0 s e g 1 1 t h e g a t e i n p u t s i g n a l o f e a c h t r a n s i s t o r i s c o n t r o l l e d b y t h e l c d d u t y r a t i o a n d t h e b i a s v a l u e . t h e v o l t a g e a p p l i e d t o t h e s o u r c e s o f p - c h a n n e l a n d n - c h a n n e l t r a n s i s t o r s i s t h e c o n t r o l l e d v o l t a g e b y t h e b i a s v a l u e .
rev.2.02 jun 19, 2007 page 21 of 73 rej03b0146-0202 3823 group t ermination of unused pins ?termination of common pins i/o ports: select an input port or an output port and follow each processing method. output ports: open. input ports: if the i nput level become unstable, through current flow to an input circuit, and the power supply current may increase. especially, when expecting low consumption current (at stp or wit instruction execution etc.), pull-up or pull-down input ports to prevent through current (built-in resistor can be used). pull-down the p4 0 / (v pp ) pin. we recommend processing unused pins through a resistor which can secure i oh(avg) or i ol(avg) . because, when an i/o port or a pin which have an output function is selected as an input port, it may operate as an output port by incorrect operation etc.
rev.2.02 jun 19, 2007 page 22 of 73 rej03b0146-0202 3823 group t able 8 termination of unused pins pin p0 0 /seg 16 ?1 7 /seg 23 p1 0 /seg 24 ?1 7 /seg 31 p2 0 /kw 0 ?2 7 /kw 7 p3 4 /seg 12 ?3 7 /seg 15 p4 0 /(v pp ) p4 1 / p4 2 /int 0 p4 3 /int 1 p4 4 /rxd p4 5 /txd p4 6 /s clk p4 7 /s rdy /s out p5 0 /int 2 p5 1 /int 3 p5 2 /rtp 0 p5 3 /rtp 1 p5 4 /cntr 0 p5 5 /cntr 1 p5 6 /t out p5 7 /adt p6 0 /an 0 ?6 7 /an 7 p7 0 /x cout p7 1 /x cin v l3 (note) v l2 (note) v l1 (note) com 0 ?om 3 seg 0 ?eg 11 av ss v ref x out t ermination 2 when selecting seg output, open. when selecting kw function, perform termination of input port. when selecting seg output, open. when selecting output, open. when selecting int 0 function, perform termination of input port. when selecting int 1 function, perform termination of input port. when selecting r x d function, perform termination of input port. when selecting t x d function, perform termination of output port. when selecting external clock input, perform termination of input port. when selecting s rdy function, perform termination of output port. when selecting int 2 function, perform termination of input port. when selecting int 3 function, perform termination of input port. when selecting rtp 0 function, perform termination of output port. when selecting rtp 1 function, perform termination of output port. when selecting cntr 0 input function, perform termination of input port. when selecting cntr 1 function, perform termination of input port. when selecting t out function, perform termination of output port. when selecting adt function, perform termination of input port. when selecting an function, these pins can be opened. (a/d conversion result cannot be guaranteed.) do not select x cin -x cout oscillation function by program. t ermination 3 when selecting internal clock output, perform termination of output port. when selecting s out function, perform termination of output port. when selecting cntr 0 output function, perform termination of output port. t ermination 1 (recommend) i/o port input port input port (pull-down) i/o port connect to v ss connect to v ss connect to v ss open open connect to v ss connect to v cc or v ss when an external clock is input to the x in pin, leave the x out pin open. note : the termination of v l3 , v l2 and v l1 is applied when the bit 3 of the lcd mode register is ?
rev.2.02 jun 19, 2007 page 23 of 73 rej03b0146-0202 3823 group interrupts the 3823 group interrupts are vector interrupts with a fixed prior- ity scheme, and generated by 16 sources among 17 sources: 8 external, 8 internal, and 1 software. the interrupt sources, vector addresses (1) , and interrupt priority are shown in table 9. each interrupt except the brk instruction interrupt has the inter- rupt request bit and the interrupt enable bit. these bits and the interrupt disable flag (i flag) control the acceptance of interrupt re- quests. figure 16 shows an interrupt control diagram. notes1: vector addresses contain interrupt jump destination addresses. 2: reset function in the same way as an interrupt with the highest priority. t able 9 interrupt vector addresses and priority remarks interrupt request generating conditions at reset at detection of either rising or falling edge of int 0 input at detection of either rising or falling edge of int 1 input at completion of serial interface data reception at completion of serial interface transmit shift or when transmis- sion buffer is empty interrupt source low high priority v ector addresses (note 1) reset (note 2) int 0 int 1 serial i/o reception serial i/o transmission t imer x t imer y t imer 2 t imer 3 cntr 0 cntr 1 t imer 1 int 2 int 3 key input (key-on wake-up) adt a/d conversion brk instruction 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 fffd 16 fffb 16 fff9 16 fff7 16 fff5 16 fff3 16 fff1 16 ffef 16 ffed 16 ffeb 16 ffe9 16 ffe7 16 ffe5 16 ffe3 16 ffe1 16 ffdf 16 ffdd 16 fffc 16 fffa 16 fff8 16 fff6 16 fff4 16 fff2 16 fff0 16 ffee 16 ffec 16 ffea 16 ffe8 16 ffe6 16 ffe4 16 ffe2 16 ffe0 16 ffde 16 ffdc 16 at timer x underflow at timer y underflow at timer 2 underflow at timer 3 underflow at detection of either rising or falling edge of cntr 0 input at detection of either rising or falling edge of cntr 1 input at timer 1 underflow at detection of either rising or falling edge of int 2 input at detection of either rising or falling edge of int 3 input at falling of conjunction of input level for port p2 (at input mode) at falling of adt input at completion of a/d conversion at brk instruction execution non-maskable external interrupt (active edge selectable) external interrupt (active edge selectable) v alid when serial interface is se- lected v alid when serial interface is se- lected external interrupt (active edge selectable) external interrupt (active edge selectable) external interrupt (active edge selectable) external interrupt (active edge selectable) external interrupt (valid at falling) v alid when adt interrupt is se- lected, external interrupt (valid at falling) v alid when a/d interrupt is se- lected non-maskable software interrupt an interrupt requests is accepted when all of the following conditions are satisfied: ?interrupt disable flag.................................? ?interrupt disable request bit .....................? ?interrupt enable bit................................... ? though the interrupt priority is determined by hardware, priority processing can be performed by software using the above bits and flag.
rev.2.02 jun 19, 2007 page 24 of 73 rej03b0146-0202 3823 group fig. 16 interrupt control diagram i n t e r r u p t r e q u e s t b i t i n t e r r u p t e n a b l e b i t i n t e r r u p t d i s a b l e f l a g ( i ) b r k i n s t r u c t i o n r e s e t i n t e r r u p t r e q u e s t interrupt disable flag the interrupt disable flag is assigned to bit 2 of the processor sta- tus register. this flag controls the acceptance of all interrupt requests except for the brk instruction. when this flag is set to ?? the acceptance of interrupt requests is disabled. when it is set to ?? acceptance of interrupt requests is enabled. this flag is set to ??with the set instruction and set to ??with the cli instruc- tion. when an interrupt request is accepted, the contents of the proces- sor status register are pushed onto the stack while the interrupt disable flag remaines set to ?? subsequently, this flag is auto- matically set to ??and multiple interrupts are disabled. to use multiple interrupts, set this flag to ??with the cli instruc- tion within the interrupt processing routine. the contents of the processor status register are popped off the stack with the rti instruction. interrupt request bits once an interrupt request is generated, the corresponding inter- rupt request bit is set to ??and remaines ??until the request is accepted. when the request is accepted, this bit is automatically set to ?? each interrupt request bit can be set to ?? but cannot be set to ?? by software. interrupt enable bits the interrupt enable bits control the acceptance of the corre- sponding interrupt requests. when an interrupt enable bit is set to ?? the acceptance of the corresponding interrupt request is dis- abled. if an interrupt request occurs in this condition, the corresponding interrupt request bit is set to ?? but the interrupt request is not accepted. when an interrupt enable bit is set to ?? acceptance of the corresponding interrupt request is enabled. each interrupt enable bit can be set to ??or ??by software. the interrupt enable bit for an unused interrupt should be set to ?? interrupt source selection the following combinations can be selected by the interrupt source selection bit of the ad control register (bit 6 of the address 0039 16 ). ?adt or a/d conversion (refer table 9)
rev.2.02 jun 19, 2007 page 25 of 73 rej03b0146-0202 3823 group fig. 17 structure of interrupt-related registers b 7 b 0 i n t e r r u p t e d g e s e l e c t i o n r e g i s t e r i n t 0 i n t e r r u p t e d g e s e l e c t i o n b i t i n t 1 i n t e r r u p t e d g e s e l e c t i o n b i t i n t 2 i n t e r r u p t e d g e s e l e c t i o n b i t i n t 3 i n t e r r u p t e d g e s e l e c t i o n b i t n o t u s e d ( r e t u r n 0 w h e n r e a d ) ( i n t e d g e : a d d r e s s 0 0 3 a 1 6 ) i n t e r r u p t r e q u e s t r e g i s t e r 1 i n t 0 i n t e r r u p t r e q u e s t b i t i n t 1 i n t e r r u p t r e q u e s t b i t s e r i a l i / o r e c e i v e i n t e r r u p t r e q u e s t b i t s e r i a l i / o t r a n s m i t i n t e r r u p t r e q u e s t b i t t i m e r x i n t e r r u p t r e q u e s t b i t t i m e r y i n t e r r u p t r e q u e s t b i t t i m e r 2 i n t e r r u p t r e q u e s t b i t t i m e r 3 i n t e r r u p t r e q u e s t b i t i nterrupt contro l reg i ster 1 i n t 0 i n t e r r u p t e n a b l e b i t i n t 1 i n t e r r u p t e n a b l e b i t s e r i a l i / o r e c e i v e i n t e r r u p t e n a b l e b i t s e r i a l i / o t r a n s m i t i n t e r r u p t e n a b l e b i t t i m e r x i n t e r r u p t e n a b l e b i t t i m e r y i n t e r r u p t e n a b l e b i t t i m e r 2 i n t e r r u p t e n a b l e b i t t i m e r 3 i n t e r r u p t e n a b l e b i t 0 : n o i n t e r r u p t r e q u e s t i s s u e d 1 : i n t e r r u p t r e q u e s t i s s u e d ( i r e q 1 : a d d r e s s 0 0 3 c 1 6 ) ( i c o n 1 : a d d r e s s 0 0 3 e 1 6 ) i n t e r r u p t r e q u e s t r e g i s t e r 2 c n t r 0 i n t e r r u p t r e q u e s t b i t c n t r 1 i n t e r r u p t r e q u e s t b i t t i m e r 1 i n t e r r u p t r e q u e s t b i t i n t 2 i n t e r r u p t r e q u e s t b i t i n t 3 i n t e r r u p t r e q u e s t b i t k e y i n p u t i n t e r r u p t r e q u e s t b i t a d t / a d c o n v e r s i o n i n t e r r u p t r e q u e s t b i t n o t u s e d ( r e t u r n s 0 w h e n r e a d ) (ireq 2 : a dd re ss 003 d 16 ) i nterrupt contro l reg i ster 2 cntr 0 i nterr upt ena bl e bi t cntr 1 interr upt enable bit time r 1 interr upt enable bit int 2 interrup t en able bit int 3 interrup t en able bit key input interrupt enable bit adt/ad conversion interrupt enable bit not used (returns ??when read) (do not wr ite 1 ?to this bit.) 0 : i nterrupts di sa bl e d 1 : interrupts enabled (icon 2 : a dd re ss 003 f 16 ) 0 : f a l l i n g e d g e a c t i v e 1 : r i s i n g e d g e a c t i v e b 7 b 0 b 7 b 0 b 7 b 0 b 7 b 0
rev.2.02 jun 19, 2007 page 26 of 73 rej03b0146-0202 3823 group interrupt request generation, acceptance, and handling interrupts have the following three phases. (i) interrupt request generation an interrupt request is generated by an interrupt source (ex- ternal interrupt signal input, timer underflow, etc.) and the corresponding request bit is set to ?? (ii) interrupt request acceptance based on the interrupt acceptance timing in each instruction cycle, the interrupt control circuit determines acceptance con- ditions (interrupt request bit, interrupt enable bit, and interrupt disable flag) and interrupt priority levels for accepting interrupt requests. when two or more interrupt requests are generated simultaneously, the highest priority interrupt is accepted. the value of interrupt request bit for an unaccepted interrupt re- mains the same and acceptance is determined at the next interrupt acceptance timing point. (iii) handling of accepted interrupt request the accepted interrupt request is processed. figure 18 shows the time up to execution in the interrupt process- ing routine, and figure 19 shows the interrupt sequence. figure 20 shows the timing of interrupt request generation, inter- rupt request bit, and interrupt request acceptance. interrupt handling execution when interrupt handling is executed, the following operations are performed automatically. (1) once the currently executing instruction is completed, an inter- rupt request is accepted. (2) the contents of the program counters and the processor status register at this point are pushed onto the stack area in order from 1 to 3. 1. high-order bits of program counter (pch) 2. low-order bits of program counter (pcl) 3. processor status register (ps) (3) concurrently with the push operation, the jump address of the corresponding interrupt (the start address of the interrupt pro- cessing routine) is transferred from the interrupt vector to the program counter. (4) the interrupt request bit for the corresponding interrupt is set to ?? also, the interrupt disable flag is set to ??and multiple interrupts are disabled. (5) the interrupt routine is executed. (6) when the rti instruction is executed, the contents of the reg- isters pushed onto the stack area are popped off in the order from 3 to 1. then, the routine that was before running interrupt processing resumes. as described above, it is necessary to set the stack pointer and the jump address in the vector area corresponding to each inter- rupt to execute the interrupt processing routine. notes the interrupt request bit may be set to ??in the following cases. ?hen setting the external interrupt active edge related registers: interrupt edge selection register (address 003a 16 ) ti mer x mode register (address 0027 16 ) t imer y mode register (address 0028 16 ) if it is not necessary to generate an interrupt synchronized with these settings, take the following sequence. (1) set the corresponding enable bit to ??(disabled). (2) set the interrupt edge selection bit (the active edge switch bit) or the interrupt source bit. (3) set the corresponding interrupt request bit to ??after one or more instructions have been executed. (4) set the corresponding interrupt enable bit to ??(enabled). fig. 18 time up to execution in interrupt routine fig. 19 interrupt sequence main routine interrupt handling routine interrupt request generated interrupt request acceptance interrupt routine starts interrupt sequence 7 cycles 7 to 23 cycles * when executing div instruction stack push and vector fetch 0 to 16 cycles * sync rd wr address bus data bus pc not used s,sps s-1,sps s-2,sps b l b h a l ,a h pc h pc l ps a l a h sync :c pu operation code fetch cycle (this is an internal signal that cannot be observed from the external unit.) bl, bh: vector address of each interrupt al, ah: jump destination address of each interrupt sps : ?0 16 ?or ?1 16 ([sps] is a page selected by the stack page selection bit of cpu mode register.) push onto stack vector fetch execute interrupt routine
rev.2.02 jun 19, 2007 page 27 of 73 rej03b0146-0202 3823 group fig. 20 timing of interrupt request generation, interrupt request bit, and interrupt acceptance internal clock sync instruction cycle t1 ir1 t2 t1 t2 t3: interrupt acceptance timing points ir1 ir2: timings points at which the interrupt request bit is set to ?? push onto stack vector fetch instruction cycle ir2 t3 note: period 2 indicates the last cycle during one instruction cycle. (1) the interrupt request bit for an interrupt request generated during period 1 is set to ??at timing point ir1. (2) the interrupt request bit for an interrupt request generated during period 2 is set to ??at timing point ir1 or ir2. the timing point at which the bit is set to ??varies depending on conditions. when two or more interrupt requests are generated during the period 2, each request bit may be set to ??at timing point ir1 or ir2 separately. 2 1
rev.2.02 jun 19, 2007 page 28 of 73 rej03b0146-0202 3823 group key input interrupt (key-on wake-up) a key-on wake-up interrupt request is generated by applying a falling edge to any pin of port p2 that have been set to input mode. in other words, it is gener1ated when and of input level goes from ??to ?? an example of using a key input interrupt is shown in figure 21, where an interrupt request is generated by pressing one of the keys consisted as an active-low key matrix which inputs to ports p2 0 ?2 3 . fig. 21 connection example when using key input interrupt and port p2 block diagram port px x ??level output port p2 7 direction register = 1 p 2 7 o u t p u t p 2 6 o u t p u t p u l l r e g i s t e r a b i t 2 = 1 p2 5 output p2 4 output p 2 3 i n p u t port p2 6 latch port p2 5 latch port p2 4 latch port p2 3 latch port p2 7 latch port p2 5 direction register = 1 port p2 4 direction register = 1 p o r t p 2 3 d i r e c t i o n r e g i s t e r = 0 p2 2 input p 2 1 i n p u t p2 0 input port p2 2 latch port p2 1 latch port p2 0 latch port p2 2 direction register = 0 port p2 1 direction register = 0 port p2 0 direction register = 0 p o r t p 2 i n p u t r e a d i n g c i r c u i t ? p- ch a nnel transistor for pull-up ?? cmos output buffer key in put interrupt request p o r t p 2 6 d i r e c t i o n r e g i s t e r = 1 ? ? ? ?? ? ?? ? ?? ? ?? ? ?? ? ?? ? ??
rev.2.02 jun 19, 2007 page 29 of 73 rej03b0146-0202 3823 group timers the 3823 group has five timers: timer x, timer y, timer 1, timer 2, and timer 3. timer x and timer y are 16-bit timers, and timer 1, timer 2, and timer 3 are 8-bit timers. all timers are down count timers. when the timer reaches ?0 16 ? an underflow occurs at the next count pulse and the correspond- ing timer latch is reloaded into the timer and the count is continued. when a timer underflows, the interrupt request bit cor- responding to that timer is set to ?? read and write operation on 16-bit timer must be performed for both high and low-order bytes. when reading a 16-bit timer, read the high-order byte first. when writing to a 16-bit timer, write the low-order byte first. the 16-bit timer cannot perform the correct operation when reading during the write operation, or when writing during the read operation. fig. 22 timer block diagram cntr 0 active edge switch bit timer 1 count source selection bit real time port control bit ?? ? p5 5 /cntr 1 ? f(x in )/16 (f( sub )16 in low-speed mode ? ) cntr 1 active edge switch bit ?0 timer y stop control bit falling edge detection period measurement mode timer y interrupt request pulse width hl continuously measurement mode rising edge detection ?0??1??1 timer y operating mode bits timer x interrupt request timer x mode register write signal p5 4 /cntr 0 q q t s p5 4 direction register pulse output mode p5 4 latch timer x stop control bit ? ? timer x write control bit q d latch q d latch ? ? ? ?0 timer x operat- ing mode bits ?0??1??1 f(x in )/16 (f(sub)/16 in low-speed mode ? ) pulse width measurement mode cntr 0 active edge switch bit pulse output mode q q t s ? p5 6 direction register p5 6 latch ? t out output active edge switch bit timer 2 write control bit ? ? t out output control bit ? p5 6 /t out f(sub) timer 3 count source selection bit ? ? timer 2 interrupt request timer 3 interrupt request timer 2 count source selection bit timer 1 interrupt request data bus f(x in )/16 (f(sub)/16 in low-speed mode ] ) f(x in )/16 (f(sub)/16 in low-speed mode ? ) f(x in )/16(f(sub)/16 in low-speed mode ? ) cntr 0 interrupt request cntr 1 interrupt request timer y operating mode bits ?0??1??0 ?1 real time port control bit ? p5 2 latch real time port control bit ? p5 3 latch timer y (low) (8) timer y (high) (8) timer 3 latch (8) timer 3 (8) timer 1 latch (8) timer 1 (8) timer 2 latch (8) timer 2 (8) timer x (low) (8) timer x (high) (8) timer x (low) latch (8) timer x (high) latch (8) timer y (low) latch (8) timer y (high) latch (8) t out output control bit ? ? ? p5 2 p5 3 p5 2 direction register p5 3 direction register p5 2 data for real time port p5 3 data for real time port ? f(sub) is the source oscillation frequency in low-speed mode. f(sub) shows the oscillation frequency of x cin or the on-chip oscillator. internal clock is f(sub)/2 in the low-speed mode.
rev.2.02 jun 19, 2007 page 30 of 73 rej03b0146-0202 3823 group tim er x t imer x is a 16-bit timer that can be selected in one of four modes and can be controlled the timer x write and the real time port by setting the timer x mode register. (1) timer mode the timer counts f(x in )/16 (or f(sub)/16 in low-speed mode). f(sub) is the source oscillation frequency in low-speed mode. f(sub) shows the oscillation frequency of x cin or the on-chip os- cillator. internal clock is f(x cin )/2 in the low-speed mode. (2) pulse output mode each time the timer underflows, a signal output from the cntr 0 pin is inverted. except for this, the operation in pulse output mode is the same as in timer mode. when using a timer in this mode, set the corresponding port p5 4 direction register to output mode. (3) event counter mode the timer counts signals input through the cntr 0 pin. except for this, the operation in event counter mode is the same as in timer mode. when using a timer in this mode, set the corre- sponding port p5 4 direction register to input mode. (4) pulse width measurement mode the count source is f(x in )/16 (or f(sub)/16 in low-speed mode). if cntr 0 active edge switch bit is ?? the timer counts while the in- put signal of cntr 0 pin is at ?? if it is ?? the timer counts while the input signal of cntr 0 pin is at ?? when using a timer in this mode, set the corresponding port p5 4 direction register to input mode. t imer x write control if the timer x write control bit is ?? when the value is written in the address of timer x, the value is loaded in the timer x and the latch at the same time. if the timer x write control bit is ?? when the value is written in the address of timer x, the value is loaded only in the latch. the value in the latch is loaded in timer x after timer x underflows. if the value is written in latch only, when writing in the timer latch at the timer underflow, the value is set in the timer and the latch at one time. additionally, unexpected value may be set in the high-or- der counter when the writing in high-order latch and the underflow of timer x are performed at the same timing. real time port control while the real time port function is valid, data for the real time port are output from ports p5 2 and p5 3 each time the timer x underflows. (however, after rewriting a data for real time port, if the real time port control bit is changed from ??to ?? data are output independent of the timer x operation.) if the data for the real time port is changed while the real time port function is valid, the changed data are output at the next underflow of timer x. before using this function, set the corresponding port direction registers to output mode. note on cntr 0 interrupt active edge selection cntr 0 interrupt active edge depends on the cntr 0 active edge switch bit. fig. 23 structure of timer x mode register t i m e r x m o d e r e g i s t e r ( t x m : a d d r e s s 0 0 2 7 1 6 ) t i m e r x w r i t e c o n t r o l b i t 0 : w r i t e v a l u e i n l a t c h a n d c o u n t e r 1 : w r i t e v a l u e i n l a t c h o n l y r e a l t i m e p o r t c o n t r o l b i t 0 : r e a l t i m e p o r t f u n c t i o n i n v a l i d 1 : r e a l t i m e p o r t f u n c t i o n v a l i d p 5 2 d a t a f o r r e a l t i m e p o r t p 5 3 d a t a f o r r e a l t i m e p o r t t i m e r x o p e r a t i n g m o d e b i t s b 5 b 4 0 0 : t i m e r m o d e 0 1 : p u l s e o u t p u t m o d e 1 0 : e v e n t c o u n t e r m o d e 1 1 : p u l s e w i d t h m e a s u r e m e n t m o d e c n t r 0 a c t i v e e d g e s w i t c h b i t 0 : c o u n t a t r i s i n g e d g e i n e v e n t c o u n t e r m o d e s t a r t f r o m h o u t p u t i n p u l s e o u t p u t m o d e m e a s u r e h p u l s e w i d t h i n p u l s e w i d t h m e a s u r e m e n t m o d e f a l l i n g e d g e a c t i v e f o r c n t r 0 i n t e r r u p t 1 : c o u n t a t f a l l i n g e d g e i n e v e n t c o u n t e r m o d e s t a r t f r o m l o u t p u t i n p u l s e o u t p u t m o d e m e a s u r e l p u l s e w i d t h i n p u l s e w i d t h m e a s u r e m e n t m o d e r i s i n g e d g e a c t i v e f o r c n t r 0 i n t e r r u p t t i m e r x s t o p c o n t r o l b i t 0 : c o u n t s t a r t 1 : c o u n t s t o p b 7 b 0
rev.2.02 jun 19, 2007 page 31 of 73 rej03b0146-0202 3823 group t imer y t imer y is a 16-bit timer that can be selected in one of four modes. (1) timer mode the timer counts f(x in )/16 (or f(sub)/16 in low-speed mode). (2) period measurement mode cntr 1 interrupt request is generated at rising/falling edge of cntr 1 pin input signal. simultaneously, the value in timer y latch is reloaded in timer y and timer y continues counting down. ex- cept for the above-mentioned, the operation in period measurement mode is the same as in timer mode. the timer value just before the reloading at rising/falling of cntr 1 pin input signal is retained until the timer y is read once after the reload. the rising/falling timing of cntr 1 pin input signal is found by cntr 1 interrupt. when using a timer in this mode, set the corre- sponding port p5 5 direction register to input mode. (3) event counter mode the timer counts signals input through the cntr 1 pin. except for this, the operation in event counter mode is the same as in timer mode. when using a timer in this mode, set the corre- sponding port p5 5 direction register to input mode. (4) pulse width hl continuously measurement mode c ntr 1 interrupt request is generated at both rising and falling edges of cntr 1 pin input signal. except for this, the operation in pulse width hl continuously measurement mode is the same as in period measurement mode. when using a timer in this mode, set the corresponding port p5 5 direction register to input mode. note on cntr 1 interrupt active edge selection cntr 1 interrupt active edge depends on the cntr 1 active edge switch bit. however, in pulse width hl continuously measurement mode, cntr 1 interrupt request is generated at both rising and falling edges of cntr 1 pin input signal regardless of the setting of cntr 1 active edge switch bit. fig. 24 structure of timer y mode register t i m e r y m o d e r e g i s t e r ( t y m : a d d r e s s 0 0 2 8 1 6 ) b 7 b 0 n o t u s e d ( r e t u r n 0 w h e n r e a d ) t i m e r y o p e r a t i n g m o d e b i t s b 5 b 4 0 0 : t i m e r m o d e 0 1 : p e r i o d m e a s u r e m e n t m o d e 1 0 : e v e n t c o u n t e r m o d e 1 1 : p u l s e w i d t h h l c o n t i n u o u s l y m e a s u r e m e n t m o d e c n t r 1 a c t i v e e d g e s w i t c h b i t 0 : c o u n t a t r i s i n g e d g e i n e v e n t c o u n t e r m o d e m e a s u r e t h e f a l l i n g e d g e t o f a l l i n g e d g e p e r i o d i n p e r i o d m e a s u r e m e n t m o d e f a l l i n g e d g e a c t i v e f o r c n t r 1 i n t e r r u p t 1 : c o u n t a t f a l l i n g e d g e i n e v e n t c o u n t e r m o d e m e a s u r e t h e r i s i n g e d g e p e r i o d i n p e r i o d m e a s u r e m e n t m o d e r i s i n g e d g e a c t i v e f o r c n t r 1 i n t e r r u p t t i m e r y s t o p c o n t r o l b i t 0 : c o u n t s t a r t 1 : c o u n t s t o p
rev.2.02 jun 19, 2007 page 32 of 73 rej03b0146-0202 3823 group t imer 1, timer 2, timer 3 t imer 1, timer 2, and timer 3 are 8-bit timers. the count source for each timer can be selected by timer 123 mode register. the timer latch value is not affected by a change of the count source. how- ever, because changing the count source may cause an inadvertent count down of the timer, rewrite the value of timer whenever the count source is changed. t imer 2 write control if the timer 2 write control bit is ?? when the value is written in the address of timer 2, the value is loaded in the timer 2 and the latch at the same time. if the timer 2 write control bit is ?? when the value is written in the address of timer 2, the value is loaded only in the latch. the value in the latch is loaded in timer 2 after timer 2 underflows. t imer 2 output control when the timer 2 (t out ) is output enabled, an inversion signal from the t out pin is output each time timer 2 underflows. in this case, set the port shared with the t out pin to the output mode. notes on timer 1 to timer 3 when the count source of timer 1 to 3 is changed, the timer count- ing value may be changed large because a thin pulse is generated in count input of timer . if timer 1 output is selected as the count source of timer 2 or timer 3, when timer 1 is written, the counting value of timer 2 or timer 3 may be changed large because a thin pulse is generated in timer 1 output. therefore, set the value of timer in the order of timer 1, timer 2 and timer 3 after the count source selection of timer 1 to 3. fig. 25 structure of timer 123 mode register t o u t o u t p u t a c t i v e e d g e s w i t c h b i t 0 : s t a r t a t h o u t p u t 1 : s t a r t a t l o u t p u t t o u t o u t p u t c o n t r o l b i t 0 : t o u t o u t p u t d i s a b l e d 1 : t o u t o u t p u t e n a b l e d t i m e r 2 w r i t e c o n t r o l b i t 0 : w r i t e d a t a i n l a t c h a n d c o u n t e r 1 : w r i t e d a t a i n l a t c h o n l y t i m e r 2 c o u n t s o u r c e s e l e c t i o n b i t 0 : t i m e r 1 o u t p u t 1 : f ( x i n ) / 1 6 ( o r f ( s u b ) / 1 6 i n l o w - s p e e d m o d e ) t i m e r 3 c o u n t s o u r c e s e l e c t i o n b i t 0 : t i m e r 1 o u t p u t 1 : f ( x i n ) / 1 6 ( o r f ( s u b ) / 1 6 i n l o w - s p e e d m o d e ) t i m e r 1 c o u n t s o u r c e s e l e c t i o n b i t 0 : f ( x i n ) / 1 6 ( o r f ( s u b ) / 1 6 i n l o w - s p e e d m o d e ) 1 : f ( s u b ) n o t u s e d ( r e t u r n 0 w h e n r e a d ) t i m e r 1 2 3 m o d e r e g i s t e r ( t 1 2 3 m : a d d r e s s 0 0 2 9 1 6 ) n o t e : f ( s u b ) i s t h e s o u r c e o s c i l l a t i o n f r e q u e n c y i n l o w - s p e e d m o d e . f ( s u b ) s h o w s t h e o s c i l l a t i o n f r e q u e n c y o f x c i n o r t h e o n - c h i p o s c i l l a t o r . i n t e r n a l c l o c k i s f ( s u b ) / 2 i n t h e l o w - s p e e d m o d e . b 7 b 0
rev.2.02 jun 19, 2007 page 33 of 73 rej03b0146-0202 3823 group serial interface serial i/o serial i/o can be used as either clock synchronous or asynchro- nous (uart) serial i/o. a dedicated timer (baud rate generator) is also provided for baud rate generation. (1) clock synchronous serial i/o mode clock synchronous serial i/o can be selected by setting the mode selection bit of the serial i/o control register to ?? for clock synchronous serial i/o, the transmitter and the receiver must use the same clock. if an internal clock is used, transfer is started by a write signal to the transmit/receive buffer register. the msb first transfer is selected as the transfer direction by setting the bit 0 in the peripheral function expansion register to ?? also, the synchronous serial i/o output switches to the p4 7 /s rdy /s out pin by setting the bit 1 in the peripheral function expansion register to ?? fig. 26 block diagram of clock synchronous serial i/o fig. 27 operation of clock synchronous serial i/o function p 4 6 / s c l k p 4 7 / s rdy1 / s out p 4 4 / r x d p 4 5 / t x d f ( x i n ) 1 / 4 1 / 4 f / f s e r i a l i / o s t a t u s r e g i s t e r s e r i a l i / o c o n t r o l r e g i s t e r r e c e i v e b u f f e r r e g i s t e r a d d r e s s 0 0 1 8 1 6 r e c e i v e s h i f t r e g i s t e r r e c e i v e b u f f e r f u l l f l a g ( r b f ) r e c e i v e i n t e r r u p t r e q u e s t ( r i ) c l o c k c o n t r o l c i r c u i t shif t c l oc k s e r i a l i / o c l o c k s e l e c t i o n b i t f r e q u e n c y d i v i s i o n r a t i o 1 / ( n + 1 ) b a u d r a t e g e n e r a t o r a d d r e s s 0 0 1 c 1 6 b r g c o u n t s o u r c e s e l e c t i o n b i t clo ck control circuit f a l l i n g - e d g e d e t e c t o r d ata b us a d d r e s s 0 0 1 8 1 6 shif t c l oc k t r ansm i t s hif t reg i ster s hif t comp l et i on fl ag (tsc) t r a n s m i t b u f f e r e m p t y f l a g ( t b e ) t r a n s m i t i n t e r r u p t r e q u e s t ( t i ) t r a n s m i t i n t e r r u p t s o u r c e s e l e c t i o n b i t add re ss 0019 16 d a t a b u s a d d r e s s 0 0 1 a 1 6 t r a n s m i t b u f f e r r e g i s t e r t r a n s m i t s h i f t r e g i s t e r ( f ( s u b ) i n l o w - s p e e d m o d e ) t r a n s f e r d i r e c t i o n s e l e c t i o n b i t s er i a l output p i n se l ect i on bi t s e r i a l o u t p u t p i n s e l e c t i o n b i t t r a n s f e r d i r e c t i o n s e l e c t i o n b i t n o t e : f ( s u b ) i s t h e s o u r c e o s c i l l a t i o n f r e q u e n c y i n l o w - s p e e d m o d e . f ( s u b ) s h o w s t h e o s c i l l a t i o n f r e q u e n c y o f x c i n o r t h e o n - c h i p o s c i l l a t o r . r e c e i v e e n a b l e s i g n a l s r d y d 7 d 0 d 1 d 2 d 3 d 4 d 5 d 6 rbf = 1 tsc = 1 t b e = 0 t b e = 1 t s c = 0 t r ans f er s hif t c l oc k (1/2 to 1/2048 of the internal clock, or an external clock) s er i a l output t x d (or s out ) s e r i a l i n p u t r x d w r i t e s i g n a l t o r e c e i v e / t r a n s m i t b u f f e r r e g i s t e r ( a d d r e s s 0 0 1 8 1 6 ) o v e r r u n e r r o r ( o e ) d e t e c t i o n n o t e s 1 : t h e t r a n s m i t i n t e r r u p t ( t i ) c a n b e g e n e r a t e d e i t h e r w h e n t h e t r a n s m i t b u f f e r r e g i s t e r h a s e m p t i e d ( t b e = 1 ) o r a f t e r t h e t r a n s m i t s h i f t o p e r a t i o n h a s e n d e d ( t s c = 1 ) , b y s e t t i n g t h e t r a n s m i t i n t e r r u p t s o u r c e s e l e c t i o n b i t ( t i c ) o f t h e s e r i a l i / o c o n t r o l r e g i s t e r . 2 : i f d a t a i s w r i t t e n t o t h e t r a n s m i t b u f f e r r e g i s t e r w h e n t s c = 0 , t h e t r a n s m i t c l o c k i s g e n e r a t e d c o n t i n u o u s l y a n d s e r i a l d a t a i s o u t p u t c o n t i n u o u s l y f r o m t h e t x d p i n . 3 : t h e r e c e i v e i n t e r r u p t ( r i ) i s s e t w h e n t h e r e c e i v e b u f f e r f u l l f l a g ( r b f ) b e c o m e s 1 . d 7 d 0 d 1 d 2 d 3 d 4 d 5 d 6 t x d a n d r x d a b o v e s h o w s t h e o p e r a t i o n w h e n s e l e c t i n g l s b f i r s t t r a n s f e r .
rev.2.02 jun 19, 2007 page 34 of 73 rej03b0146-0202 3823 group (2) asynchronous serial i/o (uart) mode clock asynchronous serial i/o mode (uart) can be selected by clearing the serial i/o mode selection bit of the serial i/o control register to ?? eight serial data transfer formats can be selected, and the transfer formats used by a transmitter and receiver must be identical. the transmit and receive shift registers each have a buffer regis- ter, but the two buffers have the same address in memory. since the shift register cannot be written to or read from directly, transmit data is written to the transmit buffer, and receive data is read from the receive buffer. the transmit buffer can also hold the next data to be transmitted, and the receive buffer register can hold a character while the next character is being received. fig. 28 block diagram of uart serial i/o fig. 29 operation of uart serial i/o function f(x in ) 1 / 4 o e p e f e 1 / 1 6 1/16 d ata b us r e c e i v e b u f f e r r e g i s t e r add re ss 0018 16 r e c e i v e s h i f t r e g i s t e r r e c e i v e b u f f e r f u l l f l a g ( r b f ) r e c e i v e i n t e r r u p t r e q u e s t ( r i ) b au d rate generato r f r equency di v i s i on rat i o 1/ ( n+1 ) add re ss 001 c 16 s t / s p / p a g e n e r a t o r tr ansmit buffer register d a t a b u s t r ansm i t s hif t reg i ster add re ss 0018 16 t r ansm i t s hif t reg i ster s hif t comp l et i on fl ag (tsc) t r ansm i t b u ff er empty fl ag (t be) t r ansm i t i nterr upt request (ti) add re ss 0019 16 s t d e t e c t o r s p d e t e c t o r uart contro l reg i ster a d d r e s s 0 0 1 b 1 6 c h a r a c t e r l e n g t h s e l e c t i o n b i t add re ss 001 a 16 b r g c o u n t s o u r c e s e l e c t i o n b i t t r a n s m i t i n t e r r u p t s o u r c e s e l e c t i o n b i t s er i a l i / o sync h rono us c l oc k se l ect i on bi t c l o c k c o n t r o l c i r c u i t c h a r a c t e r l e n g t h s e l e c t i o n b i t 7 b i t s 8 b i t s serial i/o contro l regi ster p 4 6 / s c l k s er i a l i / o stat us reg i ster p 4 4 / r x d p 4 5 / t x d ( f ( s u b ) i n l o w - s p e e d m o d e ) n o t e : f ( s u b ) i s t h e s o u r c e o s c i l l a t i o n f r e q u e n c y i n l o w - s p e e d m o d e . f ( s u b ) s h o w s t h e o s c i l l a t i o n f r e q u e n c y o f x c i n o r t h e o n - c h i p o s c i l l a t o r . i n t e r n a l c l o c k i s f ( s u b ) / 2 i n t h e l o w - s p e e d m o d e . t s c = 0 t b e = 1 r b f = 0 t b e = 0 tbe =0 rbf =1 rbf =1 s t d 0 d 1 s p d 0 d 1 s t sp tbe =1 tsc=1 ? s t d 0 d 1 s p d 0 d 1 st s p t r a n s m i t b u f f e r w r i t e s i g n a l ? g e n e r a t e d a t 2 n d b i t i n 2 - s t o p - b i t m o d e 1 s t a r t b i t 7 o r 8 d a t a b i t s 1 o r 0 p a r i t y b i t 1 o r 2 s t o p b i t ( s ) 1 : e rror fl ag d etect i on occurs at t h e same t i me t h at t h e rbf fl ag b ecom es ?? ( at 1st stop bi t, d ur i ng recept i on ) . 2 : the transmit in terrupt (ti) can be selected to occur when either the tbe or tsc flag becomes 1 by the setting of the transmit interrupt source selection bit (t ic) of the serial i/o control register. 3 : the receiv e inte rrupt (ri) is set when the rbf flag becomes ?? 4 : after data is written to the transmit buffer register when tsc=1, 0.5 to 1.5 cycles of the data shift cycle is necessary until cha nging to tsc=0. n o t e s s e r i a l o u t p u t t x d s e r i a l i n p u t r x d r ece i ve b u ff er rea d s i gna l t ransm i t or rece i ve c l oc k
rev.2.02 jun 19, 2007 page 35 of 73 rej03b0146-0202 3823 group (3) synchronous/asynchronous alternate transmit mode synchronous/asynchronous alternate transmit mode is selected by setting the transmit enable bit in the serial i/o control register to ??after setting the synchronous serial i/o output pin selection bit in the peripheral function expansion register to ?? set the syn- chronous serial i/o output pin selection bit to ??when the serial i/ o mode selection bit is set to ?? in this mode, transmit cannot be performed continuously. write to the transmit buffer register after fig. 30 block diagram of synchronous/asynchronous alternate transmit fig. 31 operation of synchronous/asynchronous alternate transmit function confirming that the transmit shift register is set to ?? and then ______ changing the serial i/o mode selection bit. the s rdy output func- tion cannot be used when the clock synchronous serial i/o is selected. also, when using the internal clock for the transfer clock (the serial i/o synchronous clock selection bit is set to ??, apply ??output to the p4 6 pin. the other operation is the same as clock synchronous serial i/o mode and asynchronous serial i/o mode (uart). 1/4 1 / 4 s e r i a l i / o s t a t u s r e g i s t e r p4 5 /t x d n o t e : f ( s u b ) i s t h e s o u r c e o s c i l l a t i o n f r e q u e n c y i n l o w - s p e e d m o d e . f ( s u b ) s h o w s t h e o s c i l l a t i o n f r e q u e n c y o f x c i n o r t h e o n - c h i p o s c i l l a t o r . baud rate generator frequency division ratio 1/(n+1) clo ck control circuit t r a n s m i t b u f f e r r e g i s t e r date bus t r a n s m i t s h i f t r e g i s t e r addre ss 0018 16 t r a n s m i t s h i f t r e g i s t e r s h i f t c o m p l e t i o n f l a g ( t s c ) t r a n s m i t b u f f e r e m p t y f l a g ( t b e ) transmit interrupt request (ti) a d d r e s s 0 0 1 9 1 6 b r g c o u n t s o u r c e s e l e c t i o n b i t serial i/o synchronous clock selection bit p4 6 /s clk p 4 7 / s r d y / s o u t f ( x i n ) f( sub) in low-speed mode ( s y n c h r o n o u s o u t p u t ) ( asynchron ous output ) s e r i a l i / o m o d e s e l e c t i o n b i t ( s i o m ) shift clock (note) t s c = 0 t b e = 1 tsc=1 st d 1 d 1 s t sp d 1 d 7 t s c = 1 s p d 1 d 7 d 0 t b e = 0t b e = 0 t b e = 0 t b e = 0 d 1 d 6 d 7 t b e = 1 t s c = 0 tsc=0 tbe=1 tsc=0 d 0 t b e = 1 t s c = 0 p4 6 /s clk p 4 5 / t x d p 4 7 / s o u t ( s y n c h r o n o u s o u t p u t ) ( asynchron ous output ) s y n c h r o n o u s s e r i a l i / o o u t p u t s e l e c t i o n b i t t r a n s m i t b u f f e r w r i t e s i g n a l s e r i a l i / o m o d e s e l e c t i o n b i t a s y n c h r o n o u s t r a n s m i t a s y n c h r o n o u s t r a n s m i t s y n c h r o n o u s t r a n s m i t synchronous tr ansmit
rev.2.02 jun 19, 2007 page 36 of 73 rej03b0146-0202 3823 group [transmit buffer/receive buffer register (tb/rb)] 0018 16 the transmit buffer register and the receive buffer register are lo- cated at the same address. the transmit buffer register is write-only and the receive buffer register is read-only. if a charac- ter bit length is 7 bits, the msb of data stored in the receive buffer register is ?? [serial i/o status register (siosts)] 0019 16 the read-only serial i/o status register consists of seven flags (bits 0 to 6) which indicate the operating status of the serial i/o function and various errors. three of the flags (bits 4 to 6) are valid only in uart mode. the receive buffer full flag (bit 1) is cleared to ??when the receive buffer is read. if there is an error, it is detected at the same time that data is transferred from the receive shift register to the receive buffer reg- ister, and the receive buffer full flag is set. a write to the serial i/o status register clears all the error flags oe, pe, fe, and se. writ- ing ??to the serial i/o enable bit (sioe) also clears all the status flags, including the error flags. all bits of the serial i/o status register are initialized to ??at reset, but if the transmit enable bit (bit 4) of the serial i/o control register has been set to ?? the transmit shift register shift completion flag (bit 2) and the transmit buffer empty flag (bit 0) become ?? [serial i/o control register (siocon)] 001a 16 the serial i/o control register contains eight control bits for the se- rial i/o function. [uart control register (uartcon) ]001b 16 the uart control register consists of four control bits (bits 0 to 3) which are valid when asynchronous serial i/o is selected and set the data format of an data transfer. one bit in this register (bit 4) is always valid and sets the output structure of the p4 5 /t x d pin. [baud rate generator (brg)] 001c 16 the baud rate generator determines the baud rate for serial trans- fer. the baud rate generator divides the frequency of the count source by 1/(n + 1), where n is the value written to the baud rate genera- tor. notes on serial i/o when setting the transmit enable bit to ?? the serial i/o transmit interrupt request bit is automatically set to ?? when not requiring the interrupt occurrence synchronized with the transmission enalbed, take the following sequence. ? set the serial i/o transmit interrupt enable bit to ??(disabled). ? set the transmit enable bit to ?? ? set the serial i/o transmit interrupt request bit to ??after 1 or more instructions have been executed. ? set the serial i/o transmit interrupt enable bit to ??(enabled).
rev.2.02 jun 19, 2007 page 37 of 73 rej03b0146-0202 3823 group fig. 32 structure of serial i/o control registers brg c ount sour ce se l ect i on bi t (css) 0: f(x in ) (f(sub) in low-speed mode) 1: f(x in )/4 (f(sub)/4 in low-spee d mode) serial i/o synchronization clock selection bit (scs) 0: brg output divided by 4 when clock synchronized serial i/o is selected. brg output divided by 16 when uart is selected. 1: external clock input when clock synchronized serial i/o is se lected. external clock input divided by 16 when uart is sele cted. s rdy , s out output enable bit (srdy) 0: p4 7 pi n ope ra tes as ordinary i/o pin 1: p4 7 pin operates as s rdy or s out output pin set the transmit disable bit and s rdy , s out output enable bits to 0 to disable transmit when selecting s out . (se tting peripheral function extension register is necessary when selecting s out .) tr ansmit interrupt source selection bit (tic) 0: interrupt when transmit buffer has emptied 1: interrupt when transmit shi ft operation is completed tr ansmit en able bit (te) 0: transmit disabled 1: transmit enabled receive enable bit (re) 0: receive disabled 1: receive enabled serial i/o mode selection bit (siom) 0: a synchronous serial i/o (uart) 1: clo ck synchronous serial i/o serial i/o enable bit (sioe) 0: serial i/o disabled (pins p4 4 ?4 7 o perate as ordinary i/o pins) 1: serial i/o enabled (pins p4 4 ?4 7 o perate as serial i/o pins) s er i a l i / o c ontro l reg i ster (s iocon : address 001a 16 ) b 7b 0 t r a n s m i t b u f f e r e m p t y f l a g ( t b e ) 0 : b u f f e r f u l l 1 : b u f f e r e m p t y r e c e i v e b u f f e r f u l l f l a g ( r b f ) 0 : b u f f e r e m p t y 1 : b u f f e r f u l l t r a n s m i t s h i f t r e g i s t e r s h i f t c o m p l e t i o n f l a g ( t s c ) 0 : t r a n s m i t s h i f t i n p r o g r e s s 1 : t r a n s m i t s h i f t c o m p l e t e d o v e r r u n e r r o r f l a g ( o e ) 0 : n o e r r o r 1 : o v e r r u n e r r o r p a r i t y e r r o r f l a g ( p e ) 0 : n o e r r o r 1 : p a r i t y e r r o r f r a m i n g e r r o r f l a g ( f e ) 0 : n o e r r o r 1 : f r a m i n g e r r o r s u m m i n g e r r o r f l a g ( s e ) 0 : ( o e ) u ( p e ) u ( f e ) = 0 1 : ( o e ) u ( p e ) u ( f e ) = 1 n o t u s e d ( r e t u r n s 1 w h e n r e a d ) s e r i a l i / o s t a t u s r e g i s t e r ( s i o s t s : a d d r e s s 0 0 1 9 1 6 ) b 7b 0 uart contro l reg i ster (uartcon : ad dress 001b 16 ) ch aracter l engt h se l ect i on bi t ( ch as) 0: 8 bits 1: 7 bits parity enable bit (pare) 0: parity checking disabled 1: parity checking enabled parity selection bit (pars) 0: even parity 1: odd parity stop bit length sel ection bit (stps) 0: 1 stop bit 1: 2 stop bits p4 5 /t x d, p4 7 /s rdy /s out p-chan nel output disable bit (poff) (note) 0: cmos output (in output mode) 1: n-channel open-drain output (in output mode) not used (return ??when read) b7 b0 1 : t h e p e r i p h e r a l f u n c t i o n e x t e n s i o n r e g i s t e r i s u s e d t o c h o o s e p 4 5 / t x d , p 4 7 / s r d y / s o u t . 2 : f ( s u b ) i s t h e s o u r c e o s c i l l a t i o n f r e q u e n c y i n l o w - s p e e d m o d e . f ( s u b ) s h o w s t h e o s c i l l a t i o n f r e q u e n c y o f x c i n o r t h e o n - c h i p o s c i l l a t o r . n otes
rev.2.02 jun 19, 2007 page 38 of 73 rej03b0146-0202 3823 group a/d converter [ad conversion register (adh, adl)] 0035 16 the ad conversion register is a read-only register that contains the result of an a/d conversion. when reading this register during an a/d conversion, the previous conversion result is read.the high-order 8 bits of a conversion result is stored in the ad conver- sion high-order register (address 0035 16 ),and the low-order 2 bits of the same result are stored in bit 7 and bit 6 of the ad conver- sion low-order register (address 0036 16 ). the bit 0 in the ad conversion low-order register is used as the conversion mode selection bit. 8-bit a/d mode is selected by set- ting this bit to ??and 10-bit a/d mode is selected by setting it to ?? [ad control register (adcon)] 0034 16 the ad control register controls the a/d conversion process. bits 0 to 2 of this register select specific analog input pins. bit 3 signals the completion of an a/d conversion. the value of this bit remains at ??during an a/d conversion, then changes to ??when the a/d conversion is completed. writing ??to this bit starts the a/d conversion. bit 4 is the v ref input switch bit which controls con- nection of the resistor ladder and the reference voltage input pin (v ref ). the resistor ladder is always connected to v ref when bit 4 is set to "1". when bit 4 is set to ?? the resistor ladder is cut off from v ref except for a/d conversion performed. when bit 5, which is the ad external trigger valid bit, is set to ?? this bit en- ables a/d conversion even by a falling edge of an adt input. set the p5 7 /adt pin to input mode (set "0" to bit 7 of port p5 direction register) when using an a/d external trigger. [comparison voltage generator] the comparison voltage generator divides the voltage between av ss and v ref , and outputs the divided voltages. [channel selector] the channel selector selects one of the input ports p6 7 /an 7 ?6 0 / an 0, and inputs it to the comparator. [comparator and control circuit] the comparator and control circuit compares an analog input volt- age with the comparison voltage and stores the result in the ad conversion register. when an a/d conversion is completed, the control circuit sets the ad conversion completion bit and the ad interrupt request bit to ?? the comparator is constructed linked to a capacitor. the conver- sion accuracy may be low because the charge is lost if the conversion speed is not enough. accordingly, set f(x in ) to at least 500khz during a/d conversion in the middle-or high-speed mode. also, do not execute the stp or wit instruction during an a/d conversion. in the low-speed mode, since the a/d conversion is executed by the built-in self-oscillation circuit, the minimum value of f(x in ) fre- quency is not limited. fig. 33 structure of ad conversion-related registers a d c o n t r o l r e g i s t e r ( a d c o n : a d d r e s s 0 0 3 4 1 6 ) ad convers i on comp l et i on bi t 0 : conversi on in progress 1 : conver sion completed a n a l o g i n p u t p i n s e l e c t i o n b i t s 0 0 0 : p 6 0 / a n 0 0 0 1 : p 6 1 / a n 1 0 1 0 : p 6 2 / a n 2 0 1 1 : p 6 3 / a n 3 1 0 0 : p 6 4 / a n 4 1 0 1 : p 6 5 / a n 5 1 1 0 : p 6 6 / a n 6 1 1 1 : p 6 7 / a n 7 v ref i nput sw i tc h bi t 0 : on du ri ng conversion 1 : always on ad externa l tr i gger va lid bi t 0 : a/d external trigger invalid 1 : a/d external trigger valid b 7 b 0 i nterrupt source se l ect i on bi t 0 : interrupt r equest at a/d conversion completed 1 : interrupt r equest at adt input falling n ot use d ( returns ??w h en rea d) ad convers i on l ow-or d er reg i ster (adl : ad dress 0036 16 ) ad convers i on spee d se l ect i on bi t 00 : f(x in )/2 (this can be used in cpum7 = ? ) 01 : f(x in ) (this can be used in cpum7 = ? ) 10 : on-c hip oscillator (this can be used in cpum7 = ? and expcm0 = 1) 11 : disabled c onvers i on mo d e se l ect i on bi t 0 : 8 bit a/d mode 1 : 10 bit a/d mode n ot use d ( returns ??w h en rea d) ? i n 10- bi t a / d mo d e a/d co nversi on data storage ?in 8- bit a/d mode not used (ind efinite at read) b 7 b 0
rev.2.02 jun 19, 2007 page 39 of 73 rej03b0146-0202 3823 group fig. 34 a/d conversion register reading fig. 35 a/d converter block diagram ad conv ersion hi g h-order re g ister d a t a b u s a / d c o n t r o l c i r c u i t r e s i s t o r l a d d e r av ss v ref c o m p a r a t o r a d t / a / d i n t e r r u p t r e q u e s t b7 b0 a d c o n t r o l r e g i s t e r 3 p 6 0 / s i n 2 / a n 0 p 6 1 / a n 1 p6 2 /an 2 p 6 3 / a n 3 p 6 4 / a n 4 p 6 5 / a n 5 p6 6 /an 6 p6 7 /an 7 p 5 7 / a d t (address 0035 16 ) (address 0036 16 ) ad conv ersion low-order re g ister c h a n n e l s e l e c t o r conv ersion mode selection bit ad conversion speed selection bit a d c o n v e r s i o n l o w - o r d e r r e g i s t e r ( a d d r e s s 0 0 3 6 1 6 ) a d l a d c o n v e r s i o n h i g h - o r d e r r e g i s t e r ( a d d r e s s 0 0 3 5 1 6 ) a d h b1 b 0 b 7 b0 1 0 b i t r e a d i n g ( r e a d a d d r e s s 0 0 3 5 1 6 b e f o r e 0 0 3 6 1 6 ) b 7 b9 b8 b0 b7 b6 b5 b4 b3 b2 ( high-or der) (low-o r der) note: the bit 5 to bit 3 of address 0036 16 become "0" at reading. ? 8 bit reading (read only address 0035 16 ) b7 b7 b 6 b 0 b 5b 4b 3b 2b1b 0 ( a d d r e s s 0 0 3 5 1 6 ) 000
rev.2.02 jun 19, 2007 page 40 of 73 rej03b0146-0202 3823 group lcd drive control circuit the 3823 group has the built-in liquid crystal display (lcd) drive control circuit consisting of the following. lcd display ram segment output enable register lcd mode register selector t iming controller common driver segment driver bias control circuit a maximum of 32 segment output pins and 4 common output pins can be used. up to 128 pixels can be controlled for lcd display. when the lcd fig. 36 structure of segment output enable register and lcd mode register enable bit is set to ??after data is set in the lcd mode register, the segment output enable register and the lcd display ram, the lcd drive control circuit starts reading the display data automati- cally, performs the bias control and the duty ratio control, and displays the data on the lcd panel. t able 10 maximum number of display pixels at each duty ratio duty ratio maximum number of display pixel 64 dots or 8 segment lcd 8 digits 96 dots or 8 segment lcd 12 digits 128 dots or 8 segment lcd 16 digits 2 3 4 lcd mode register (l m : address 0039 16 ) s e g m e n t o u t p u t e n a b l e r e g i s t e r ( s e g : a d d r e s s 0 0 3 8 1 6 ) duty ra tio se lecti on bits 0 0 : not used 0 1 : 2 (use com 0 , com 1 ) 1 0 : 3 (use com 0 ?om 2 ) 1 1 : 4 (use com 0 ?om 3 ) bias control bit 0 : 1/3 bias 1 : 1/2 bias lcd enable bit 0 : lcd off 1 : lcd on no t used (returns 0 when read) (do not write 1 to this bit) lcd circuit divider division ratio selection bits 0 0 : clock input 0 1 : 2 division of clock input 1 0 : 4 division of clock input 1 1 : 8 division of clock input lcdck count source selection bit (note) 0 : f(sub)/32 1 : f(x in )/ 8192 (or f(sub)/8192 in low-speed m ode) n o t e : l c d c k i s a c l o c k f o r a l c d t i m i n g c o n t r o l l e r . f ( s u b ) i s t h e s o u r c e o s c i l l a t i o n f r e q u e n c y i n l o w - s p e e d m o d e . f ( s u b ) s h o w s t h e o s c i l l a t i o n f r e q u e n c y o f x c i n o r t h e o n - c h i p o s c i l l a t o r . i n t e r n a l c l o c k i s f ( s u b ) / 2 i n t h e l o w - s p e e d m o d e . segment output enable bit 0 0 : input port p3 4 ?3 7 1 : segment output seg 12 ?eg 15 segment output enable bit 1 0 : i/o port p0 0 ,p0 1 1 : segment output seg 16 , seg 17 segment output enable bit 2 0 : i/o port p0 2 ?0 7 1 : segment output seg 18 ?eg 23 segment output enable bit 3 0 : i/o port p1 0 ,p1 1 1 : segment output seg 24 , seg 25 segment output enable bit 4 0 : i/o port p1 2 1 : segment output seg 26 segment output enable bit 5 0 : i/o port p1 3 ?1 7 1 : segment output seg 27 ?eg 31 no t used (returns 0 when read) no t used (returns 0 when read) (do not write ?? to this bit.) b 7b 0 b7 b0
rev.2.02 jun 19, 2007 page 41 of 73 rej03b0146-0202 3823 group fig. 37 block diagram of lcd controller/driver c o m 0 c o m 1 c o m 2 c o m 3 v s s v l 1 v l 2 v l 3 s e g 3 s e g 2 s e g 1 s e g 0 1 0 l c d c k 2 2 p 1 7 / s e g 3 1 p 1 6 / s e g 3 0 p 3 4 / s e g 1 2 f ( s u b ) / 3 2 f ( x i n ) / 8 1 9 2 ( o r f ( s u b ) / 8 1 9 2 i n l o w - s p e e d m o d e ) d a t a b u s a d d r e s s 0 0 4 0 1 6 a d d r e s s 0 0 4 1 1 6 a d d r e s s 0 0 4 f 1 6 s e l e c t o r s e l e c t o r s e l e c t o r s e l e c t o r s e l e c t o r s e l e c t o r s e g m e n t d r i v e r s e g m e n t d r i v e r s e g m e n t d r i v e r s e g m e n t d r i v e r s e g m e n t d r i v e r s e g m e n t d r i v e r b i a s c o n t r o l l c d d i v i d e r t i m i n g c o n t r o l l e r c o m m o n d r i v e r d u t y r a t i o s e l e c t i o n b i t s c o m m o n d r i v e r c o m m o n d r i v e r c o m m o n d r i v e r b i a s c o n t r o l b i t l c d c i r c u i t d i v i d e r d i v i s i o n r a t i o s e l e c t i o n b i t s l c d c k c o u n t s o u r c e s e l e c t i o n b i t l c d d i s p l a y r a m l c d e n a b l e b i t v c c l c d e n a b l e b i t n o t e : f ( s u b ) i s t h e s o u r c e o s c i l l a t i o n f r e q u e n c y i n l o w - s p e e d m o d e . f ( s u b ) s h o w s t h e o s c i l l a t i o n f r e q u e n c y o f x c i n o r t h e o n - c h i p o s c i l l a t o r .
rev.2.02 jun 19, 2007 page 42 of 73 rej03b0146-0202 3823 group bias control and applied voltage to lcd power input pins to the lcd power input pins (v l1 ? l3 ), apply the voltage shown in table 11 according to the bias value. select a bias value by the bias control bit (bit 2 of the lcd mode register). common pin and duty ratio control the common pins (com 0 ?om 3 ) to be used are determined by duty ratio. select duty ratio by the duty ratio selection bits (bits 0 and 1 of the lcd mode register). fig. 38 example of circuit at each bias t able 12 duty ratio control and common pins used duty ratio common pins used notes1: com 2 and com 3 are open. 2: com 3 is open. bit 1 bit 0 com 0 , com 1 (note 1) duty ratio selection bit 2 3 4 0 1 1 1 0 1 com 0 ?om 2 (note 2) com 0 ?om 3 t able 11 bias control and applied voltage to v l1 ? l3 bias value 1/3 bias v oltage value v l3 =v lcd v l2 =2/3 v lcd v l1 =1/3 v lcd note 1: v lcd is the maximum value of supplied voltage for the lcd panel. 1/2 bias v l3 =v lcd v l2 =v l1 =1/2 v lcd c ontrast control 1 / 2 b i a s 1 / 3 b i a s c ontrast control v l3 r 4 r 5 r 4 = r 5 r 1 r2 r 3 r 1 = r 2 = r 3 v l 2 v l1 v l3 v l 2 v l1
rev.2.02 jun 19, 2007 page 43 of 73 rej03b0146-0202 3823 group lcd display ram address 0040 16 to 004f 16 is the designated ram for the lcd dis- play. when ??are written to these addresses, the corresponding segments of the lcd display panel are turned on. fig. 39 lcd display ram map lcd drive timing the lcdck timing frequency (lcd drive timing) is generated in- ternally and the frame frequency can be determined with the following equation; f(lcdck) = frame frequency = (frequency of count source for lcdck) (divider division ratio for lcd) f(lcdck) (duty ratio) b i t a d d r e s s 7 0040 16 0041 16 0042 16 0043 16 0044 16 0045 16 0046 16 0047 16 0048 16 0049 16 004a 16 004b 16 004c 16 004d 16 004e 16 004f 16 com 3 0 1 2 3 4 5 6 com 0 com 1 com 2 com 3 com 0 com 1 com 2 seg 1 seg 3 seg 5 seg 7 seg 9 seg 11 seg 13 seg 15 seg 17 seg 19 seg 21 seg 23 seg 25 seg 27 seg 29 seg 31 seg 0 seg 2 seg 4 seg 6 seg 8 seg 10 seg 12 seg 14 seg 16 seg 18 seg 20 seg 22 seg 24 seg 26 seg 28 seg 30 stp instruction execution execution of the stp instruction sets the lcd enable bit (bit 3 of the lcd mode register) to ??and the lcd panel turns off.to make the lcd panel turn on after returning from the stop mode, set the lcd enable bit to ??
rev.2.02 jun 19, 2007 page 44 of 73 rej03b0146-0202 3823 group fig. 40 lcd drive waveform (1/2 bias) i n t e r n a l l o g i c l c d c k t i m i n g 1 / 4 d u t y volta ge level v l 3 v l 2 = v l 1 v ss v l 3 v s s c o m 0 c o m 1 c o m 2 c o m 3 s e g 0 o f fo n off o n c o m 3 com 2 com 1 com 0 com 3 c o m 2 c o m 1 c o m 0 1 / 3 d u t y v l 3 v l2 =v l1 v ss v l 3 v ss o f f o n o noff o no f f 1 / 2 d u t y c o m 0 com 1 c o m 2 seg 0 c o m 0 c o m 1 s e g 0 v l3 v l 2 = v l 1 v s s v l 3 v s s off on off on off on off on c o m 0 c o m 2 c o m 1 com 0 c o m 2 c o m 1 c o m 0 c o m 2 c o m 1 c o m 0 c o m 1 com 0 c o m 1 c o m 0 c o m 1 c o m 0
rev.2.02 jun 19, 2007 page 45 of 73 rej03b0146-0202 3823 group fig. 41 lcd drive waveform (1/3 bias) i n t e r n a l l o g i c l c d c k t i m i n g 1 / 4 d u t y v o l t a g e l e v e l v l 3 v s s c o m 0 com 1 c o m 2 c o m 3 seg 0 o f fon o f fo n com 3 com 2 com 1 com 0 com 3 com 2 com 1 com 0 1 / 3 d u t y off o n on off o noff 1/2 duty com 0 c o m 1 c o m 2 seg 0 c o m 0 c o m 1 seg 0 off o n o f f o n o f f o n off o n v l 3 v l 2 v s s v l 1 v l 3 v l 2 v ss v l 1 v l3 v ss v l3 v l 2 v ss v l 1 v l 3 v s s c o m 0 com 2 com 1 com 0 c o m 2 c o m 1 c o m 0 c o m 2 c o m 1 c o m 0 c o m 1 c o m 0 c o m 1 c o m 0 c o m 1 c o m 0
rev.2.02 jun 19, 2007 page 46 of 73 rej03b0146-0202 3823 group rom correction function a part of program in rom can be corrected. set the start address of the corrected rom data (i.e. an op code address of the beginning instruction) to the rom correction ad- dress low-order and high-order registers. the program for the correction is stored in ram for rom correction. when the program is being executed and the value of the program counter matches with the set address value in the the rom cor- rection address registers,the program is branched to the start address of ram for rom correction and then the correction pro- gram is executed. use the jmp instruction (3-byte instruction) to return the main program from the correction program. the correctable area is up to two. there are two blocks of ram for rom correction: block 1: address 0a00 16 block 2: address 0a20 16 the rom correction function is controlled by the rom correction enable register. if the rom correction function is not used, the rom correction vector may be used as normal ram. when using the rom correc- tion vector as normal ram, make sure to set bits 1 and 0 in the rom correction enable register to ??(disable). notes 1 : when using the rom correction function, set the rom correction address registers and then enable the rom correction with the rom correction enable register. 2 : do not set addresses other than the rom area in the rom correction address registers. do not set the same addresses in both the rom correc- tion address 1 registers and the rom correction address 2 registers. 3 : it is necessary to contain the process in the program to transfer the correction program from an external eeprom and others to the ram for rom correction. fig. 42 rom correction address register fig. 44 structure of rom correction enable register 0 0 1 0 1 6 rom correction address 1 high-order register (rca1h) 0 0 1 1 1 6 0012 16 0013 16 rom correction address 1 low-order register (rca1l) rom correction address 2 low-order register (rca2l) rom correction address 2 high-order register (rca2h) note: do not set addressed other than the rom area. a d d r e s s 1 e n a b l e b i t ( r c 0 ) 0 : d i s a b l e 1 : e n a b l e a d d r e s s 2 e n a b l e b i t ( r c 1 ) 0 : d i s a b l e 1 : e n a b l e n o t u s e d ( r e t u r n s 0 w h e n r e a d ) r o m c o r r e c t i o n e n a b l e r e g i s t e r ( a d d r e s s 0 0 1 4 1 6 ) ( n o t e ) r c r b 7b 0 n o t e : s e t t h e r o m c o r r e c t i o n a d d r e s s r e g i s t e r s b e f o r e e n a b l i n g t h e r o m c o r r e c t i o n w i t h t h e r o m c o r r e c t i o n e n a b l e r e g i s t e r . fig. 43 ram for rom correction r a m 1 f o r r o m c o r r e c t i o n r a m 2 f o r r o m c o r r e c t i o n 0 a 00 16 0 a 1 f 16 0 a 20 16 0 a 3 f 16
rev.2.02 jun 19, 2007 page 47 of 73 rej03b0146-0202 3823 group clock system output function the internal system clock or x cin frequency signal can be out- put from port p4 1 by setting the output control register. set bit 1 of the port p4 direction register to ??when outputting clock. fig. 45 structure of output control register output control register (ckout : ad dress 002a 16 ) output control bit 0 : port function 1 : clock out put or x cin fr equency signal output no t used (return 0 when read) b 7 b 0 te mporary data register the temporary data register (addresses 002c 16 to 002e 16 ) is the 8-bit register and does not have the control function. it can be used to store data temporarily. it is initialized after reset. rrf register the rrf register (address 002f 16 )is the 8-bit register and does not have the control function. as for the value written in this regis- ter, high-order 4 bits and low-order 4 bits interchange. it is initialized after reset. fig. 46 structure of temporary register, rpf register set the bit 4 in the peripheral function expansion register to ? when the x cin frequency signal is output. b7 b0 t e m p o r a r y d a t a r e g i s t e r 0 , 1 , 2 ( a d d r e s s : 0 0 2 c 1 6 , 0 0 2 d 1 6 , 0 0 2 e 1 6 ) d b 0 d a t a s t o r a g e d b 1 d a t a s t o r a g e d b 2 d a t a s t o r a g e d b 3 d a t a s t o r a g e d b 4 d a t a s t o r a g e d b 5 d a t a s t o r a g e d b 6 d a t a s t o r a g e d b 7 d a t a s t o r a g e td 0 ,td 1 ,td 2 b 7b 0 r r f r e g i s t e r ( a d d r e s s : 0 0 2 f 1 6 ) d b 4 d a t a s t o r a g e d b 5 d a t a s t o r a g e d b 6 d a t a s t o r a g e d b 7 d a t a s t o r a g e d b 0 d a t a s t o r a g e d b 1 d a t a s t o r a g e d b 2 d a t a s t o r a g e d b 3 d a t a s t o r a g e r r f r
rev.2.02 jun 19, 2007 page 48 of 73 rej03b0146-0202 3823 group watchdog timer the watchdog timer gives a mean of returning to the reset status when a program cannot run on a normal loop (for example, be- cause of a software run-away). the watchdog timer consists of an 8-bit counter. initial value of watchdog timer at reset or writing to the watchdog timer control register, each watchdog timer is set to ?f 16 .?instructions such as sta, ldm and clb to generate the write signals can be used. the written data in bits 0 to 5 are not valid, and the above values are set. bits 7 and 6 can be rewritten only once after reset. after rewriting it is disable to write any data to this bit. these bits become ??after reset. standard operation of watchdog timer the watchdog timer is in the stop state at reset and the watchdog timer starts to count down by writing an optional value in the watchdog timer control register. an internal reset occurs at an un- derflow of the watchdog timer. then, reset is released after the reset release time is elapsed, the program starts from the reset vector address. normally, writing to the watchdog timer control register before an underflow of the watchdog timer is pro- grammed. if writing to the watchdog timer control register is not executed, the watchdog timer does not operate. when reading the watchdog timer control register is executed, the contents of the high-order 6-bit counter and the stp instruction bit (bit 6), and the count source selection bit (bit 7) are read out. bit 6 of watchdog timer control register ?when bit 6 of the watchdog timer control register is ?? the mcu enters the stop mode by execution of stp instruction. just after releasing the stop mode, the watchdog timer restarts counting (note). when executing the wit instruction, the watch- dog timer does not stop. ?when bit 6 is ?? execution of stp instruction causes an internal reset. when this bit is set to ??once, it cannot be rewritten to ??by program. bit 6 is ??at reset. the time until the underflow of the watchdog timer register after writing to the watchdog timer control register is executed is as fol- lows (when the bit 7 of the watchdog timer control register is ?? ; ?at frequency/2/4/8 mode (f(x in )) = 8 mhz): 32.768 ms ?at low-speed mode (f(x cin ) = 32 khz): 8.19s note the watchdog timer continues to count even during the wait time set by timer 1 and timer 2 to release the stop state and in the wait mode. accordingly, do not underflow the watchdog timer in this time. fig. 47 block diagram of watchdog timer fig. 48 structure of watchdog timer control register fig. 49 timing of reset output i n t e r n a l r e s e t s i g n a l w a t c h d o g t i m e r d e t e c t i o n = 3 2 m s e c ( f ( x i n ) = 8 m h z ) f ( x i n ) watchdog timer h (for read-out of high-order 6 bit) ?f 16 ?is set to watchdog timer by writing to these bits. watchdog timer count source selection bit 0: f(x in )/1024 (f( sub )/1024 at low-speed mode) 1: f(x in )/4 (f( sub )/1024 at low-speed mode) stp instruction function selection bit 0: entering stop mode by execution of stp instruction 1: internal reset by execution of stp instruction watchdog timer control register (address 0037 16 ) wdtcon b7 b0 note : bits 6 and 7 can be rewritten only once after reset. after rewriting it is disable to write any data to this bit. x in data bus x cin internal system clock selection bit (bit 7 of the cpu mode register) 1/1024 watchdog timer h (6) watchdog timer count source selection bit reset circuit undefined instruction reset ?f 16 ?is set when watchdog timer control register is written to. internal reset reset wait until reset release watchdog timer l (2) stp instruction stp instruction bit 1/4 ? ? ? ? on-chip oscillator mode control bit on-chip oscillator
rev.2.02 jun 19, 2007 page 49 of 73 rej03b0146-0202 3823 group peripheral function extension register the serial i/o transfer direction can be switched by setting the bit 0 in the peripheral function expansion register to ?? this function is valid only when the bit 6 in the serial i/o control register is set to ??(when the clock synchronous serial i/o is selected). p4 7 can be selected as the output pin of the clock synchronous serial i/o by setting the bit 1 in the peripheral function expansion register to ?? when setting p4 7 to the s out pin, set the bit 7 in the port p4 direction register to ?? this function is valid only when the bit 6 in the serial i/o control register to ??(when the clock synchronous serial i/o is selected). p-channel output of t x d and s out can be disabled by the bits 2 and 3 in the peripheral function expansion register. set the bit 4 in the uart control register to ??after se- lecting the pin to disable the p-channel output. x cin frequency signal can be output from the port p4 1 by setting the bit 4 in the peripheral function expansion register to ?? set the bit 0 in the output control register and the bit 1 in the port p4 direction regis- ter to ??to output the x cin frequency signal. fig. 50 structure of peripheral function extension register transfer direction selection bit (valid when uart is used) 0 : lsb first 1 : msb first sy nchronous serial i/o output pin selection bit 0:p4 5 /t x d pin 1:p4 7 /s rdy /s out pin p-c hannel output disabled selection bit 00: p4 5 /t x d pin 01: the bit 4 in the uart control regist er is invalid 10: p4 5 /t x d pi n or p47/s rdy /s out pin 11: p4 7 /s rdy /s out pin output clock selection bit 0: clock output 1: x cin frequency signal output not us ed (returns ??when read) (do not write ? to this bit) peripheral f unction extension register (address: 0030 16 ) exp b 7b 0
rev.2.02 jun 19, 2007 page 50 of 73 rej03b0146-0202 3823 group reset circuit to reset the microcomputer, reset pin should be held at an ? level for 2 ? or more. then the reset pin is returned to an ? level (the power source voltage should be between v cc (min.) and 5.5 v, and the quartz-crystal oscillator should be stable), reset is released. after the reset is completed, the program starts from the address contained in address fffd 16 (high-order byte) and ad- dress fffc 16 (low-order byte). make sure that the reset input voltage meets v il spec. when a power source voltage passes v cc (min.). fig. 51 reset circuit example fig. 52 reset sequence p o w e r o n p o w e r s o u r c e v o l t a g e r e s e t i n p u t v o l t a g e p o w e r s o u r c e v o l t a g e d e t e c t i o n c i r c u i t v i l s p e c . 0 v 0 v v c c r e s e t v c c r e s e t r e s e t i n t e r n a l r e s e t a d d r e s s d a t a s y n c x in x i n : a b o u t 8 0 0 0 c y c l e s r e s e t a d d r e s s f r o m v e c t o r t a b l e n o t e s 1 : t h e f r e q u e n c y r e l a t i o n o f f ( x i n ) a n d f ( ) i s f ( x i n ) = 8 f ( ) 2 : t h e q u e s t i o n m a r k s ( ? ) i n d i c a t e a n u n d e f i n e d s t a t e t h a t d e p e n d s o n t h e p r e v i o u s s t a t e . f f f cf f f d a d h , a d l ad l ad h ????
rev.2.02 jun 19, 2007 page 51 of 73 rej03b0146-0202 3823 group fig. 53 initial status of microcomputer after reset p o r t p 0 d i r e c t i o n r e g i s t e r p o r t p 1 d i r e c t i o n r e g i s t e r p o r t p 2 d i r e c t i o n r e g i s t e r p o r t p 4 d i r e c t i o n r e g i s t e r p o r t p 5 d i r e c t i o n r e g i s t e r p o r t p 6 d i r e c t i o n r e g i s t e r p o r t p 7 d i r e c t i o n r e g i s t e r r o m c o r r e c t o i n e n a b l e r e g i s t e r ( r c r ) p u l l r e g i s t e r a p u l l r e g i s t e r b s i r i a l i / o s t a t u s r e g i s t e r s i r i a l i / o c o n t r o l r e g i s t e r u a r t c o n t r o l r e g i s t e r t i m e r x h i g h - o r d e r r e g i s t e r t i m e r x l o w - o r d e r r e g i s t e r t i m e r y h i g h - o r d e r r e g i s t e r t i m e r y l o w - o r d e r r e g i s t e r t i m e r 1 r e g i s t e r t i m e r 2 r e g i s t e r t i m e r 3 r e g i s t e r t i m e r x m o d e r e g i s t e r t i m e r y m o d e r e g i s t e r t i m e r 1 2 3 m o d e r e g i s t e r o u t p u t c o n t r o l r e g i s t e r c p u m o d e e x t e n s i o n r e g i s t e r te m p o r a r y d a t a r e g i s t e r 0 t e m p o r a r y d a t a r e g i s t e r 1 t e m p o r a r y d a t a r e g i s t e r 2 r r f r e g i s t e r p e r i p h e r a l f u n c t i o n e x t e n s i o n r e g i s t e r a d c o n t r o l r e g i s t e r a d c o n v e r s i o n l o w - o r d e r r e g i s t e r w a t c h d o g t i m e r c o n t r o l r e g i s t e r s e g m e n t o u t p u t e n a b l e r e g i s t e r l c d m o d e r e g i s t e r i n t e r r u p t e d g e s e l e c t i o n r e g i s t e r c p u m o d e r e g i s t e r i n t e r r u p t r e q u e s t r e g i s t e r 1 i n t e r r u p t r e q u e s t r e g i s t e r 2 i n t e r r u p t c o n t r o l r e g i s t e r 1 i n t e r r u p t c o n t r o l r e g i s t e r 2 p r o c e s s o r s t a t u s r e g i s t e r p r o g r a m c o u n t e r note: the contents of all other registers and ram are undefined after reset, so they must be initialized by software. ? : undefined r e g i s t e r c o n t e n t s a ddress 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 f f 1 6 f f 1 6 f f 1 6 f f 1 6 f f 1 6 0 1 1 6 f f 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 0 0 1 6 c o n t e n t s o f a d d r e s s f f f d 1 6 c o n t e n t s o f a d d r e s s f f f c 1 6 ( 1 ) ( 2 ) ( 3 ) ( 4 ) ( 5 ) ( 6 ) ( 7 ) ( 8 ) ( 9 ) ( 1 0 ) ( 1 1 ) ( 1 2 ) ( 1 3 ) ( 1 4 ) ( 1 5 ) ( 1 6 ) ( 1 7 ) ( 1 8 ) ( 1 9 ) ( 2 0 ) ( 2 1 ) ( 2 2 ) ( 2 3 ) ( 2 4 ) ( 2 5 ) ( 2 6 ) ( 2 7 ) ( 2 8 ) ( 2 9 ) ( 3 0 ) ( 3 1 ) ( 3 2 ) ( 3 3 ) ( 3 4 ) ( 3 5 ) ( 3 6 ) ( 3 7 ) ( 3 8 ) ( 3 9 ) ( 4 0 ) ( 4 1 ) ( 4 2 ) ( 4 3 ) 0001 16 0003 16 0005 16 0009 16 000b 16 000d 16 000f 16 0014 16 0016 16 0017 16 0019 16 001a 16 001b 16 0020 16 0021 16 0022 16 0023 16 0024 16 0025 16 0026 16 0027 16 0028 16 0029 16 002a 16 002b 16 002c 16 002d 16 002e 16 002f 16 0030 16 0034 16 0036 16 0037 16 0038 16 0039 16 003a 16 003b 16 003c 16 003d 16 003e 16 003f 16 ( ps) (pc h ) (pc l ) 0 0001 00 0 1 1100 00 0 1 0000 00 0 0 0001 11 0 ?? 000 00 0 00111 11 1 ????? ?? 1 01001 00 0
rev.2.02 jun 19, 2007 page 52 of 73 rej03b0146-0202 3823 group clock generating circuit the 3823 group has two built-in oscillation circuits. an oscillation circuit can be formed by connecting a resonator between x in and x out (x cin and x cout ). use the circuit constants in accordance with the resonator manufacturer's recommended values. the os- cillation start voltage and the oscillation start time differ in accordance with an oscillator, a circuit constant, or temperature, etc. when power supply voltage is low and the high frequency oscilla- tor is used, an oscillation start will require sufficient conditions. no external resistor is needed between x in and x out since a feed- back resistor exists on-chip. (an external feed-back resistor may be needed depending on conditions.) however, an external feed- back resistor is needed between x cin and x cout since a resistor does not exist between them. to supply a clock signal externally, input it to the x in pin and make the x out pin open. the sub-clock x cin -x cout oscillation circuit cannot directly input clocks that are externally generated. accord- ingly, be sure to cause an external resonator to oscillate. immediately after poweron, only the x in oscillation circuit starts oscillating, and x cin and x cout pins function as i/o ports. fig. 55 external clock input circuit x i n e x t e r n a l o s c i l l a t i o n c i r c u i t open v c c v s s c c i n c c o u t rf rd x c i n x c o u t x o u t frequency control (1) frequency/8 mode the internal clock is the frequency of x in divided by 8. after reset, this mode is selected. (2) frequency/4 mode the internal clock is the frequency of x in divided by 4. (3) frequency/2 mode the internal clock is half the frequency of x in . (4) low-speed mode the internal clock is the frequency of x in or on-chip oscillation frequency divided by 2. a low-power consumption operation can be realized by stopping the main clock x in in this mode. to stop the main clock, set bit 5 of the cpu mode register to ?? when the main clock x in is restarted, set enough time for oscil- lation to stabilize by programming. in low speed mode, the system clock can be switched to the on-chip oscillator or x cin . use the on-chip oscillator control bit (bit 0 in the cpu mode expansion register) for settings. to set this bit to ??from ?? wait until x cin oscillation stabilizes. note 1: if you switch the mode between frequency/2/4/8 mode and low-speed, stabilize both x in and x cin oscillations. the sufficient time is required for the sub-clock to stabi- lize, especially immediately after poweron and at returning from stop mode. when switching the mode be- tween middle/high-speed and low-speed, set the frequency on condition that f(x in ) > 3f(x cin ). 2: in frequency/2/4/8 mode, x in -x out oscillation does not stop even if the main clock (x in -x out ) stop bit is set to "1". 3: in low speed mode, x cin- x cout oscillation does not stop even if the port x c switch bit is set to "0". fig. 54 ceramic resonator circuit example x cin x cout x in x out c in c out c cin c cout rf rd rd note : insert a damping resistor if required. the resistance will vary depending on the oscillator and the oscillation drive capacity setting. use the value recommended by the maker of the oscillator. also, if the oscillator manufacturer's data sheet specifies that a feedback resistor be added external to the chip though a feedback resistor exists on-chip, insert a feedback resistor between x in and x out following the instruction.
rev.2.02 jun 19, 2007 page 53 of 73 rej03b0146-0202 3823 group fig. 56 clock generating circuit block diagram oscillation control (1) stop mode if the stp instruction is executed, the internal clock stops at an ??level, and x in and x cin oscillators stop. timer 1 is set to ?f 16 ?and timer 2 is set to ?1 16 ? either x in or x cin divided by 16 is input to timer 1 as count source, and the output of timer 1 is connected to timer 2. the bits of the timer 123 mode register except bit 4 are cleared to ?? set the timer 1 and timer 2 interrupt enable bits to disabled (?? be- fore executing the stp instruction. oscillator restarts at reset or when an external interrupt is received, but the internal clock is not supplied to the cpu until timer 2 underflows. this allows timer for the clock circuit oscillation to stabilize. execution of the stp instruction sets the lcd enable bit (bit 3 of the lcd mode register) to ??and the lcd panel turns off.to make the lcd panel turn on after returning from the stop mode, set the lcd enable bit to ?? (2) wait mode if the wit instruction is executed, only the system clock stops at an "h" state. the states of main clock, on-chip oscillator and sub clock are the same as the state before executing the wit instruc- tion, and oscillation does not stop. since supply of system clock is started immediately after the interrupt is received, the instruc- tion can be executed immediately. timing (internal system clock) main clock stop bit timer 2 timer 1 1/2 1/4 xin xout wit instruction stp instruction s r q stp instruction s r q s r q interrupt request interrupt disable flag 1 reset 1/2 ? ? timer 1 count source selection bit ? ? timer 2 count source selection bit low-speed mode frequency/2/4/8 mode (note 1) frequency/8 mode frequency/2/4 mode or low- speed mode internal system clock selection bit main clock division ratio selection bit ? ? ? ? notes 1: when using the low-speed mode, set the port x c switch bit to ??. 2: although a feed-back resistor exists on-chip, an external feed-back resistor may be needed depending on conditions. frequency/4 mode control bit 1/2 xcout xcin port xc switch bit ? ? on-chip oscillator on-chip oscillator control bit f(sub) (note 2)
rev.2.02 jun 19, 2007 page 54 of 73 rej03b0146-0202 3823 group notes 1 : switch the mode by the allows shown between the mode blocks. (do not switch between the mode directly without an allow.) 2 : the all modes can be switched to the stop mode or the wait mode and returned to the source mode when the stop mode or the wait mode is ended. 3 : timer and lcd operate in the wait mode. 4 : when the stop mode is ended, a delay of approximately 1 ms occurs automatically by timer 1 and timer 2 in frequency/2/4/8 mode . 5 : when the stop mode is ended, a delay of approximately 0.25 s occurs automatically by timer 1 and timer 2 in low-speed mode. 6 : wait until oscillation stabilizes after oscillating the main clock x in before the switching from the low-speed mode to frequency/2/4/8 mode. 7 : the example assumes that 8 mhz is being applied to the x in pin and 32 khz to the x cin pin. indicates the internal clock. 8 : f(sub) is the source oscillation frequency in low-speed mode. f(sub) shows the oscillation frequency of x cin or the on-chip oscillator. internal clock is f(sub)/2 in the low-speed mode. 9 : set the cpu mode expansion register in advance when switching to low-speed mode which uses mode divided by 4 and on-chip oscil lator. 10: in low speed mode, the system clock can be switched to the on-chip oscillator or x cin . use the on-chip oscillator control bit (bit 0 in the cpu mode expansion register) for settings. to set this bit to "0" from "1", wait until x cin oscillation stabilizes. cm 4 : port xc switch bit (note 1) 0: i/o port (oscillation stopped) 1: x cin , x cout oscillating function cm 5 :m ain clock (x in ? out ) stop bit (note 2) 0: oscillating 1: stopped cm 6 :m ain clock division ratio selection bit 0: f(x in )/2 (frequency/2 mode), or f(x in )/4 (frequency/4 mode) (note 3) 1: f(x in )/8 (frequency/8 mode) cm 7 :i nternal system clock selection bit 0: x in ? out selected (frequency/2/4/8 mode) 1: x cin ? cout , or on-chip oscillator selected (low-speed mode) (note 4) cpu mode register (cpum : address 003b 16 ) b7 b4 rese t cm 6 ? ? cm 4 ? ? cm 7 = 0 (8 mhz selected) cm 6 = 1 (frequency/8) cm 5 = 0 (8 mhz oscillating) cm 4 = 0 (stopped) frequency/8 mode (f( ) = 1 mhz) frequency/8 mode (f( ) = 1 mhz) cm 7 = 0 (8 mhz selected) cm 6 = 0 (frequency/2/4) cm 5 = 0 (8 mhz oscillating) cm 4 = 0 (stopped) frequency/2 mode (f( ) = 4 mhz) or frequency/4 mode (f( ) = 2 mhz) frequency/2 mode (f( ) = 4 mhz) or frequency/4 mode (f( ) = 2 mhz) cm 7 = 1 (32 khz or on-chip oscillator selected) cm 6 = 1 (middle-speed) cm 5 = 0 (8 mhz oscillating) cm 4 = 1 (oscillating) low-speed mode (f(sub)/2) cm 7 = 1 (32 khz or on-chip oscillator selected) cm 6 = 0 (high-speed) cm 5 = 0 (8 mhz oscillating) cm 4 = 1 (oscillating) low-speed mode (f(sub)/2) cm 7 = 1 (32 khz or on-chip oscillator selected) cm 6 = 1 (middle-speed) cm 5 = 1 (8 mhz stopped) cm 4 = 1 (oscillating) low-power dissipation mode (f(sub)/2) cm 6 ? ? cm 6 ? ? cm 6 ? ? cm 4 ? ? cm 7 ? ? cm 7 ? ? cm 5 ? ? cm 5 ? ? cm 4 cm 6 ? ? ? ? cm 4 cm 6 ? ? ? ? cm 5 cm 6 ? ? ? ? cm 5 cm 6 ? ? ? ? cm 7 = 0 (8 mhz selected) cm 6 = 1 (frequency/8) cm 5 = 0 (8 mhz oscillating) cm 4 = 1 (oscillating) or expcm0 = 1 (on-chip oscillator oscillation) cm 7 = 1 (32 khz or on-chip oscillator selected) cm 6 = 0 (high-speed) cm 5 = 1 (8 mhz stopped) cm 4 = 1 (oscillating) low-power dissipation mode (f(sub)/2) cm 7 = 0 (8 mhz selected) cm 6 = 0 (frequency/2/4) cm 5 = 0 (8 mhz oscillating) cm 4 = 1 (oscillating) or expcm0 = 1 (on-chip oscillator oscillation) on-chip oscillator control bit 0 : on-chip oscillator not used (on-chip oscillator stopping) 1 : on-chip oscillator used (note 1) (on-chip oscillator oscillating) frequency/4 mode control bit (note 2) (valid only when high-speed mode) 0 : frequency/2 mode = f(x in )/2 1 : frequency/4 mode = f(x in )/4 not used (returns ??when read) (do not write ??to this bit) cpu mode extension register (expcm : address: 002b 16 ,) b7 b4 note 1 : the on-chip oscillator is selected for the operation clock in low-speed mode regardless of x cin- x cout . 2 : valid only when the main clock division ratio selection bit (bit 6 in the cpu mode register) is set to "0". when "1" (frequency/8 mode) is selected for the main clock division ratio selection bit or when the internal system clock selection bit is set to 1, set "0" to the frequency/4 mode control bit. note 1 : in low speed mode (x cin is selected as the system clock ? ), x cin -x cout oscillation does not stop even if the port x c switch bit is set to "0". 2 : in frequency/2/4/8 mode, x in -x out oscillation does not stop even if the main clock (x in -x out ) stop bit is set to "1". 3 : when the system clock is divided by 4 of f(x in ), set the bit 6 in the cpu mode register to ??after setting the bit 1 in the cpu mode extension register to ?? 4 : when using the on-chip oscillator in low-speed mode, set the bit 7 in the cpu mode register to ??after setting the bit 0 in the cpu mode extension register to ?? fig. 57 state transitions of system clock
rev.2.02 jun 19, 2007 page 55 of 73 rej03b0146-0202 3823 group qzrom writing mode in the qzrom writing mode, the user rom area can be rewritten while the microcomputer is mounted on-board by using a serial programmer which is applicable for this microcomputer. t able 13 lists the pin description (qzrom writing mode) and fig- ure 58 and figure 59 show the pin connections. refer to figure 60 and figure 61 for examples of a connection with a serial programmer. contact the manufacturer of your serial programmer for serial pro- grammer. refer to the users manual of your serial programmer for details on how to use it. t able 13 pin description (qzrom writing mode) ?apply 1.8 to 5.5 v to v cc , and 0 v to v ss . reset input pin for active ?? reset occurs when reset pin is hold at an ??level for 16 cycles or more of x in . set the same termination as the single-chip mode. ?input the reference voltage of a/d converter to v ref . connect avss to vss. ?input ??or ??level signal or leave the pin open. ?qzrom programmable power source pin. ?serial data i/o pin. ?serial clock input pin. ?read/program pulse input pin. v cc , v ss reset x in x out v ref av ss p0 0 ?0 7 p1 0 ?1 7 p2 0 ?2 7 p3 4 ?3 7 p4 1 ?4 4 p5 0 ?5 7 p6 0 ?6 7 p4 0 p4 4 p4 2 p4 3 power source reset input clock input clock output analog reference voltage analog power source i/o port v pp input esda input/output esclk input espgmb input function pin name input input input output input input i/o input i/o input input i/o
rev.2.02 jun 19, 2007 page 56 of 73 rej03b0146-0202 3823 group fig. 58 pin connection diagram (m3823xgx-xxxfp) seg 8 seg 9 p3 4 /seg 12 p3 5 /seg 13 p0 0 /seg 16 p0 3 /seg 19 p0 4 /seg 20 p0 5 /seg 21 p0 6 /seg 22 p0 7 /seg 23 p1 1 /seg 25 p1 2 /seg 26 p1 3 /seg 27 p1 4 /seg 28 p1 5 /seg 29 p1 6 /seg 30 p1 7 /seg 31 vl 1 p6 7 /an 7 m3823xgx-xxxfp m3823xgxfp p5 7 /adt p5 0 /int 2 p4 6 /s clk p4 5 /t x d p4 3 /int 1 p4 2 /int 0 av ss v ref v cc seg 0 p4 1 / p4 0 x in x ou t v ss p2 7 /kw 7 p2 6 /kw 6 p2 5 /kw 5 p2 4 /kw 4 p2 3 /kw 3 p2 2 /kw 2 p2 1 /kw 1 p2 0 /kw 0 reset p5 1 /int 3 p5 5 /cntr 1 p5 4 /cntr 0 p5 3 /rtp 1 p5 2 /rtp 0 p5 6 /t out p1 0 /seg 24 p0 1 /seg 17 p0 2 /seg 18 p4 7 /s rdy /s out seg 10 seg 11 p3 6 /seg 14 p3 7 /seg 15 p7 0 /x cout p7 1 /x cin com 0 vl 3 p6 6 /an 6 p6 5 /an 5 p6 4 /an 4 p6 3 /an 3 p6 2 /an 2 p6 1 /an 1 p6 0 /an 0 vl 2 com 1 com 2 com 3 seg 1 seg 2 seg 3 seg 4 seg 5 seg 6 seg 7 p4 4 /r x d 123456789101112131415161718192021222324 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 *: connect to oscillation circuit. : qzrom pin prqp0080gb-a (80p6n-a) * esda esclk espgmb gnd reset v pp gnd v cc fig. 59 pin connection diagram (m3823xgx-xxxhp) 1 2 3 4 7 8 9 10 11 12 13 14 15 16 17 18 19 20 5 6 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 p1 4 /seg 28 p1 5 /seg 29 p1 6 /seg 30 p1 7 /seg 31 p4 2 /int 0 v cc x in x out v ss reset p7 0 /x cout p7 1 /x cin p4 1 / p4 0 p4 3 /int 1 seg 10 p3 5 /seg 13 p3 6 /seg 14 p3 7 /seg 15 p0 0 /seg 16 p0 3 /seg 19 p0 4 /seg 20 p0 5 /seg 21 p0 6 /seg 22 p0 7 /seg 23 p1 1 /seg 25 p1 2 /seg 26 p1 0 /seg 24 p0 1 /seg 17 p0 2 /seg 18 p1 3 /seg 27 com 3 p6 0 /an 0 p5 7 /adt p5 6 /t out p5 4 /cntr 0 p5 3 /rtp 1 p5 2 /rtp 0 p5 1 /int 3 p5 5 /cntr 1 p4 6 /s clk p4 5 /t x d p5 0 /int 2 p4 7 /s rdy /s out p4 4 /r x d seg 1 seg 2 seg 3 seg 4 seg 6 seg 5 seg 7 seg 0 seg 8 seg 9 com 2 com 1 com 0 v l3 v l2 v l1 v ref av ss p6 1 /an 1 p6 2 /an 2 p6 3 /an 3 p6 4 /an 4 p6 5 /an 5 p6 6 /an 6 p6 7 /an 7 seg 11 p3 4 /seg 12 m3823xgx-xxxhp m3823xgxhp p2 7 /kw 7 p2 6 /kw 6 p2 5 /kw 5 p2 4 /kw 4 p2 3 /kw 3 p2 2 /kw 2 p2 1 /kw 1 p2 0 /kw 0 plqp0080kb-a ( 80p6q-a ) * *: connect to oscillation circuit. : qzrom pin gnd esda esclk espgmb gnd reset v pp v cc
rev.2.02 jun 19, 2007 page 57 of 73 rej03b0146-0202 3823 group fig. 60 when using e8 programmer, connection example 3 8 2 3 g r o u p reset circuit set the same termination as the single-chip mode. v c c p 4 4 ( e s d a ) p 4 2 ( e s c l k ) p4 3 ( espgmb) r e s e t vss a v s s x i n x out 4 . 7 k ? * 1 : open-collector buffer note: for the programming circuit, the wiring capacity of each signal pin must not exceed 47 pf. v c c 14 1 2 1 0 8 1 3 1 1 9 7 4 2 6 3 1 *1 p 4 0 4 . 7 k ? 5
rev.2.02 jun 19, 2007 page 58 of 73 rej03b0146-0202 3823 group fig. 61 when using programmer of sisei electronics system co., ltd, connection example 3 8 2 3 g r o u p t _ v d d t _ v p p t_rxd t _ s c l k t _ p g m / o e / m d t_reset g n d reset circuit s e t t h e s a m e t e r m i n a t i o n a s t h e s i n g l e - c h i p m o d e . vcc p4 0 p4 4 ( esda) p4 2 ( esclk) p4 3 ( espgmb) reset vss avss x i n x out 4.7 k ? 4 . 7 k ? note: for the programming circuit, the wiring capacity of each signal pin must not exceed 47 pf. t _ t x d t_busy n.c.
rev.2.02 jun 19, 2007 page 59 of 73 rej03b0146-0202 3823 group notes on programming processor status register the contents of the processor status register (ps) after a reset are undefined, except for the interrupt disable flag (i) which is ?? af- ter a reset, initialize flags which affect program execution. in particular, it is essential to initialize the index x mode (t) and the decimal mode (d) flags because of their effect on calculations. initialize these flags at the beginning of the program. interrupt the contents of the interrupt request bits do not change immedi- ately after they have been written. after writing to an interrupt request register, execute at least one instruction before perform- ing a bbc or bbs instruction. decimal calculations ? o calculate in decimal notation, set the decimal mode flag (d) to ?? then execute an adc or sbc instruction. after executing an adc or sbc instruction, execute at least one instruction be- fore executing a sec, clc, or cld instruction. in decimal mode, the values of the negative (n), overflow (v), and zero (z) flags are invalid. t imers if a value n (between 0 and 255) is written to a timer latch, the fre- quency division ratio is 1/(n + 1). multiplication and division instructions the index mode (t) and the decimal mode (d) flags do not affect the mul and div instruction. the execution of these instructions does not change the contents of the processor status register. ports the contents of the port direction registers cannot be read. the following cannot be used: the data transfer instruction (lda, etc.) the operation instruction when the index x mode flag (t) is ? the addressing mode which uses the value of a direction regis- ter as an index the bit-test instruction (bbc or bbs, etc.) to a direction register the read-modify-write instruction (ror, clb, or seb, etc.) to a direction register use instructions such as ldm and sta, etc., to set the port direc- tion registers. serial interface in clock synchronous serial i/o, if the receive side is using an ex- ternal clock and it is to output the s rdy signal, set the transmit enable bit, the receive enable bit, and the s rdy output enable bit to ?? serial i/o continues to output the final bit from the t x d pin after transmission is completed. a/d converter the comparator is constructed linked to a capacitor. the conver- sion accuracy may be low because the charge is lost if the conversion speed is not enough. accordingly, set f(x in ) to at least 500khz during a/d conversion in the middle-or high-speed mode. also, do not execute the stp or wit instruction during an a/d conversion. in the low-speed mode, since the a/d conversion is executed by the on-chip oscillator, the minimum value of f(x in ) frequency is not limited. lcd drive control circuit execution of the stp instruction sets the lcd enable bit (bit 3 of the lcd mode register) to ??and the lcd panel turns off.to make the lcd panel turn on after returning from the stop mode, set the lcd enable bit to ?? instruction execution time the instruction execution time is obtained by multiplying the fre- quency of the internal clock by the number of cycles needed to execute an instruction. the number of cycles required to execute an instruction is shown in the list of machine instructions. the frequency of the internal clock is half of the x in frequency.
rev.2.02 jun 19, 2007 page 60 of 73 rej03b0146-0202 3823 group countermeasures against noise (1) shortest wiring length ? wiring for reset pin make the length of wiring which is connected to the reset pin as short as possible. especially, connect a capacitor across the reset pin and the v ss pin with the shortest possible wiring (within 20mm). reason the width of a pulse input into the reset pin is determined by the timing necessary conditions. if noise having a shorter pulse width than the standard is input to the reset pin, the reset is released before the internal state of the microcomputer is com- pletely initialized. this may cause a program runaway. (2) connection of bypass capacitor across v ss line and v cc line in order to stabilize the system operation and avoid the latch-up, connect an approximately 0.1 f bypass capacitor across the v ss line and the v cc line as follows: ?connect a bypass capacitor across the v ss pin and the v cc pin at equal length. ?connect a bypass capacitor across the v ss pin and the v cc pin with the shortest possible wiring. ?use lines with a larger diameter than other signal lines for v ss line and v cc line. ?connect the power source wiring via a bypass capacitor to the v ss pin and the v cc pin. ? wiring for clock input/output pins ?make the length of wiring which is connected to clock i/o pins as short as possible. ?make the length of wiring (within 20 mm) across the grounding lead of a capacitor which is connected to an oscillator and the v ss pin of a microcomputer as short as possible. ?separate the v ss pattern only for oscillation from other v ss patterns. reason if noise enters clock i/o pins, clock waveforms may be de- formed. this may cause a program failure or program runaway. also, if a potential difference is caused by the noise between the v ss level of a microcomputer and the v ss level of an oscil- lator, the correct clock will not be input in the microcomputer. reset reset circuit noise v ss v ss reset circuit v ss reset v ss n.g. o.k. noise x in x out v ss x in x out v ss n.g. o.k. v ss v cc       v ss v cc           n.g. o.k. fig. 63 wiring for clock i/o pins fig. 62 wiring for the reset pin fig. 64 bypass capacitor across the v ss line and the v cc line
rev.2.02 jun 19, 2007 page 61 of 73 rej03b0146-0202 3823 group (3) oscillator concerns in order to obtain the stabilized operation clock on the user system and its condition, contact the oscillator manufacturer and select the oscillator and oscillation circuit constants. be careful espe- cially when range of votage and temperature is wide. also, take care to prevent an oscillator that generates clocks for a microcomputer operation from being affected by other signals. ? keeping oscillator away from large current signal lines install a microcomputer (and especially an oscillator) as far as possible from signal lines where a current larger than the toler- ance of current value flows. reason in the system using a microcomputer, there are signal lines for controlling motors, leds, and thermal heads or others. when a large current flows through those signal lines, strong noise oc- curs because of mutual inductance. ? installing oscillator away from signal lines where potential levels change frequently install an oscillator and a connecting pattern of an oscillator away from signal lines where potential levels change frequently. also, do not cross such signal lines over the clock lines or the signal lines which are sensitive to noise. reason signal lines where potential levels change frequently (such as the cntr pin signal line) may affect other lines at signal rising edge or falling edge. if such lines cross over a clock line, clock waveforms may be deformed, which causes a microcomputer failure or a program runaway. ? keeping oscillator away from large current signal lines ? installing oscillator away from signal lines where potential levels change frequently fig. 66 wiring for the p4 0 /(v pp) pin fig. 65 wiring for a large current signal line/ w iring of signal lines where potential levels change frequently a p p r o x . 5 k ? t h e s h o r t e s t p 4 0 / ( v p p ) v s s p 4 0 / ( v p p ) v s s t h e s h o r t e s t t h e s h o r t e s t a p p r o x . 5 k ? ( n o t e ) ( n o t e ) ( n o t e ) ( n o t e ) n o t e . s h o w s t h e m i c r o c o m p u t e r ' s p i n . (4) analog input the analog input pin is connected to the capacitor of a voltage comparator. accordingly, sufficient accuracy may not be obtained by the charge/discharge current at the time of a/d conversion when the analog signal source of high-impedance is connected to an analog input pin. in order to obtain the a/d conversion result stabilized more, please lower the impedance of an analog signal source, or add the smoothing capacitor to an analog input pin. (5) difference of memory size when memory size differ in one group, actual values such as an electrical characteristics, a/d conversion accuracy, and the amount of -proof of noise incorrect operation may differ from the ideal values. when these products are used switching, perform system evalua- tion for each product of every after confirming product specification. (6) wiring to p4 0 /(v pp) pin when using p4 0 /(v pp ) pin as an input port, connect an approximately 5 k ? resistor to the p4 0 /(v pp ) pin the shortest possible in series. when not using p4 0 /(v pp ) pin, connect the pin the shortest pos- sible to the gnd pattern which is supplied to the vss pin of the microcomputer. in addition connecting an approximately 5 k ? re- sistor in series to the gnd could improve noise immunity. in this case as well as the above mention, connect the pin the shortest possible to the gnd pattern which is supplied to the vss pin of the microcomputer. reason the p4 0 /(v pp ) pin of the qzrom version is the power source input pin for the built-in qzrom. when programming in the qzrom, the im- pedance of the vpp pin is low to allow the electric current for writing to flow into the built-in qzrom. because of this, noise can enter easily. if noise enters the p4 0 /(v pp ) pin, abnormal instruction codes or data are read from the qzrom, which may cause a program runaway. x in x out v ss microcomputer mutual inductance large current gnd m x in x out v ss cntr do not cross n.g. (1) when using p4 0 /(v pp ) pin as an input port (2) when not using p4 0 /(v pp ) pin
rev.2.02 jun 19, 2007 page 62 of 73 rej03b0146-0202 3823 group fig. 67 strengthening measure example of lcd drive power supply 3823 group v l 3 v l 2 v l1 ? o n n e c t b y t h e s h o r t e s t p o s s i b l e w i r i n g . ? o n n e c t t h e b y p a s s c a p a c i t o r t o t h e v l 1 v l 3 p i n s a s s h o r t a s p o s s i b l e . ( r e f e r e n t i a l v a l u e : 0 . 1 0 . 3 3 f ) notes on use power source voltage when the power source voltage value of a microcomputer is less than the value which is indicated as the recommended operating conditions, the microcomputer does not operate normally and may perform unstable operation. in a system where the power source voltage drops slowly when the power source voltage drops or the power supply is turned off, reset a microcomputer when the power source voltage is less than the recommended operating conditions and design a system not to cause errors to the system by this unstable operation. lcd drive power supply power supply capacitor may be insufficient with the division resis- tance for lcd power supply,and the characteristic of the lcd panel.in this case,there is the method of connecting the bypass capacitor about 0.1 ?.33? to v l1 ? l3 pins.the example of a strengthening measure of the lcd drive power supply is shown in figure 67. product shipped in blank as for the product shipped in blank, renesas does not perform the writing test to user rom area after the assembly process though the qzrom writing test is performed enough before the assembly process. therefore, a writing error of approx.0.1 % may occur. moreover, please note the contact of cables and foreign bodies on a socket, etc. because a writing environment may cause some writing errors. overvoltage make sure that voltage exceeding the vcc pin voltage is not ap- plied to other pins. in particular, ensure that the state indicated by bold lines in figure below does not occur for pin p4 0 (v pp power source pin for qzrom) during power-on or power-off. otherwise the contents of qzrom could be rewritten. notes on qzrom notes on qzrom writing orders when ordering the qzrom product shipped after writing, submit the mask file (extension: .msk) which is made by the mask file converter mm. be sure to set the rom option ("mask option" written in the mask file converter) setup when making the mask file by using the mask file converter mm. notes on rom code protect (qzrom product shipped after writing) as for the qzrom product shipped after writing, the rom code protect is specified according to the rom option setup data in the mask file which is submitted at ordering. the rom option setup data in the mask file is ?0 16 ?for protect enabled or ?f 16 ?for protect disabled. therefore, the contents of the rom code protect address (other than the user rom area) of the qzrom product shipped after writing is ?0 16 ?or ?f 16 ? note that the mask file which has nothing at the rom option data or has the data other than ?0 16 ?and ?f 16 ?can not be accepted. data required for qzrom writing orders the following are necessary when ordering a qzrom product shipped after writing: 1. qzrom writing confirmation form* 2. mark specification form* 3. rom data...........mask file * for the qzrom writing confirmation form and the mark specifi- cation form, refer to the ?enesas technology corp.?homepage (http://www.renesas.com). note that we cannot deal with special font marking (customer's trademark etc.) in qzrom microcomputer. p4 0 pin voltage ??input v cc pin voltage p4 0 pin voltage ??input (1) input voltage to other mcu pins rises before vcc pin voltage. (2) input voltage to other mcu pins falls after vcc pin voltage. note: the internal circuitry is unstable when vcc is below the minimum voltage specification of 1. 8 v (shaded portion), so particular care should be exercised re g ardin g overvolta g e. 1.8v 1.8v ~ ~ ~ ~ ~ ~ fig. 68 t iming diagram (applies to section indicated by bold line.)
rev.2.02 jun 19, 2007 page 63 of 73 rej03b0146-0202 3823 group v o v o pd t opr t stg ?.3 to 6.5 v power source voltage input voltage p0 0 ?0 7 , p1 0 ?1 7 , p2 0 ?2 7 , p3 4 ?3 7 , p4 0 ?4 7 , p5 0 ?5 7 p6 0 ?6 7 , p7 0 , p7 1 v cc v i symbol parameter conditions ratings unit all voltages are based on v ss . when an input voltage is mea- sured, output transistors are cut off. v i v i v i v i v o v o v o input voltage v l1 input voltage v l2 input voltage v l3 input voltage reset, x in output voltage p0 0 ?0 7 , p1 0 ?1 7 output voltage p3 4 ?3 7 output voltage p2 0 ?2 7 , p4 1 ?4 7 ,p5 0 ?5 7 , p6 0 ?6 7 , p7 0 , p7 1 output voltage seg 0 ?eg 11 output voltage x out power dissipation operating temperature storage temperature at output port at segment output at segment output ?.3 to v cc +0.3 ?.3 to v l2 v l1 to v l3 v l2 to 6.5 ?.3 to v cc +0.3 ?.3 to v cc +0.3 ?.3 to v l3 ?.3 to v l3 ?.3 to v cc +0.3 ?.3 to v l3 ?.3 to v cc +0.3 300 ?0 to 85 ?0 to 150 v v v v v v v v v v v mw ? ? ta = 25? (v cc = 1.8 to 5.5 v, ta = ?0 to 85 ?, unless otherwise noted) 5.5 5.5 5.5 5.5 5.5 5.5 5.5 5.5 5.5 5.5 5.5 5.5 v cc v ref v cc symbol parameter limits min. v v v v v v v v v v v v v v v v unit 4.5 4.0 2.0 1.8 2.5 2.0 1.8 2.5 2.0 1.8 1.8 2.5 1.8 av ss 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 5.0 0 0 t yp. max. power source voltage ( note 1 ) frequency/2 mode f(x in ) = 10 mhz f(x in ) = 8 mhz f(x in ) = 5 mhz f(x in ) = 2.5 mhz frequency/4 mode f(x in ) = 10 mhz f(x in ) = 8 mhz f(x in ) = 5 mhz frequency/8 mode f(x in ) = 10 mhz f(x in ) = 8 mhz f(x in ) = 5 mhz low-speed mode (oco included) t able 14 absolute maximum ratings t able 15 recommended operating conditions (1) note : when the a/d converter is used, refer to the recommended operating condition for a/d converter. v ss v l 3 v ref av ss v ia power source voltage lcd power voltage a/d conversion reference voltage analog power source voltage analog input voltage an 0 ?n 7 electrical characteristics
rev.2.02 jun 19, 2007 page 64 of 73 rej03b0146-0202 3823 group (v cc = 1.8 to 5.5 v, ta = ?0 to 85 ?, unless otherwise noted) ??input voltage p0 0 ?0 7 , p1 0 ?1 7 ,p3 4 ?3 7 , p4 0 , p4 1 , p4 5 , p4 7 , p5 2 , p5 3, p5 6, p6 0 ?6 7, p7 0 ,p7 1 (cm 4 = 0) ??input voltage p2 0 ?2 7 , p4 2 ?4 4 ,p4 6 ,p5 0 , p5 1 , p5 4 , p5 5 , p5 7 ??input voltage reset ??input voltage x in ??input voltage p0 0 ?0 7 , p1 0 ?1 7 ,p3 4 ?3 7 , p4 0 , p4 1 , p4 5 , p4 7 , p5 2 , p5 3, p5 6, p6 0 ?6 7, p7 0 ,p7 1 (cm 4 = 0) ??input voltage p2 0 ?2 7 , p4 2 ?4 4 ,p4 6 ,p5 0 , p5 1 , p5 4 , p5 5 , p5 7 ??input voltage reset ??input voltage x in v cc v cc v cc v cc 0.3 v cc 0.2 v cc 0.2 v cc 0.2 v cc v ih v ih v ih v ih v il v il v il v il symbol parameter limits min. v v v v v v v v unit 0.7v cc 0.8v cc 0.8v cc 0.8v cc 0 0 0 0 t yp. max. t able 16 recommended operating conditions (2)
rev.2.02 jun 19, 2007 page 65 of 73 rej03b0146-0202 3823 group p0 0 ?0 7 , p1 0 ?1 7 , p2 0 ?2 7 (note 1) p4 1 ?4 7 , p5 0 ?5 7 , p6 0 ?6 7, p7 0 , p7 1 (note 1) p0 0 ?0 7 , p1 0 ?1 7 , p2 0 ?2 7 (note 1) p4 1 ?4 7 , p5 0 ?5 7 , p6 0 ?6 7, p7 0 , p7 1 (note 1) p0 0 ?0 7 , p1 0 ?1 7 , p2 0 ?2 7 (note 1) p4 1 ?4 7 , p5 0 ?5 7 , p6 0 ?6 7, p7 0 , p7 1 (note 1) p0 0 ?0 7 , p1 0 ?1 7 , p2 0 ?2 7 (note 1) p4 1 ?4 7 , p5 0 ?5 7 , p6 0 ?6 7, p7 0 , p7 1 (note 1) p0 0 ?0 7 , p1 0 ?1 7 (note 2) p2 0 ?2 7 , p4 1 ?4 7 , p5 0 ?5 7 , p6 0 ?6 7, p7 0 , p7 1 (note 2) p0 0 ?0 7 , p1 0 ?1 7 (note 2) p2 0 ?2 7 , p4 1 ?4 7 , p5 0 ?5 7 , p6 0 ?6 7, p7 0 , p7 1 (note 2) p0 0 ?0 7 , p1 0 ?1 7 (note 3) p2 0 ?2 7 , p4 1 ?4 7 , p5 0 ?5 7 , p6 0 ?6 7, p7 0 , p7 1 (note 3) p0 0 ?0 7 , p1 0 ?1 7 (note 3) p2 0 ?2 7 , p4 1 ?4 7 , p5 0 ?5 7 , p6 0 ?6 7, p7 0 , p7 1 (note 3) ?0 ?0 40 40 ?0 ?0 20 20 ? ? (v cc = 1.8 to 5.5 v, ta = ?0 to 85 ?, unless otherwise noted) notes 1: the total output current is the sum of all the currents flowing through all the applicable ports. the total average current is an average value measured over 100 ms. the total peak current is the peak value of all the currents. 2: the peak output current is the peak current flowing in each port. 3: the average output current is an average value measured over 100 ms. 4: when the a/d converter is used, refer to the recommended operating condition for a/d converter. 5: when using the microcomputer in low-speed mode, make sure that the sub-clock input oscillation frequency on condition that f(x cin ) < f(x in )/3. ??total peak output current ??total peak output current ??total peak output current ??total peak output current ??total average output current ??total average output current ??total average output current ??total average output current ??peak output current ??peak output current i oh(peak) i oh(peak) i ol(peak) i ol(peak) i oh(avg) i oh(avg) i ol(avg) i ol(avg) i oh(peak) i oh(peak) symbol parameter limits min. ma ma ma ma ma ma ma ma ma ma unit t yp. max. i ol(peak) i ol(peak) i oh(avg) i oh(avg) i ol(avg) 5 10 ?.0 ?.5 ma ma ma ma ma ma ??peak output current ??peak output current ??average output current ??average output current ??average output current ??average output current input frequency for timers x and y (duty cycle 50%) i ol(avg) f(cntr 0 ) f(cntr 1 ) mhz mhz mhz mhz mhz mhz mhz mhz mhz mhz mhz mhz mhz mhz khz (4.5 v v cc 5.5 v) (4.0 v v cc 4.5 v) (2.0 v v cc 4.0 v) (v cc 2.0 v) frequency/2 mode (4.5 v v cc 5.5 v) frequency/2 mode (4.0 v v cc 4.5 v) frequency/2 mode (2.0 v v cc 4.0 v) frequency/2 mode (1.8 v v cc 2.0 v) frequency/4 mode (2.5 v v cc 5.5 v) frequency/4 mode (2.0 v v cc 2.5 v) frequency/4 mode (1.8 v v cc 2.0 v) frequency/8 mode (2.5 v v cc 5.5 v) frequency/8 mode (2.0 v v cc 2.5 v) frequency/8 mode (1.8 v v cc 2.0 v) 32.768 main clock input oscillation frequency (duty cycle 50%) (note 4) sub-clock input oscillation frequency (duty cycle 50%) (note 5) f(x in ) 2.5 5.0 5.0 2 ? v cc ?4 0.75 ? v cc + 1 6.25 ? v cc - 10 10.0 4 ? v cc ?8 1.5 ? v cc + 2 12.5 ? v cc - 20 10.0 4 ? v cc 15 ? v cc ?22 10.0 4 ? v cc 15 ? v cc ?22 80 t able 17 recommended operating conditions (3) f(x cin )
rev.2.02 jun 19, 2007 page 66 of 73 rej03b0146-0202 3823 group i ol = 10 ma i ol = 2.5 ma i ol = 2.5 ma v cc = 2.5 v i ol = 5 ma i ol = 1.25 ma i ol = 1.25 ma v cc = 2.5 v v ol i oh = ?.5 ma i oh = ?.6 ma v cc = 2.5 v i oh = ? ma i oh = ?.25 ma i oh = ?.25 ma v cc = 2.5 v v v cc ?.0 ??output voltage p0 0 ?0 7 , p1 0 ?1 7 symbol parameter limits min. unit 0.5 t yp. max. t est conditions v oh 2.0 0.5 (v cc = 4.0 to 5.5 v, ta = ?0 to 85 ?, unless otherwise noted) reset : v cc = 2.0 v to 5.5 v v i = v cc pull-downs ?ff v cc = 5 v, v i = v cc pull-downs ?n v cc = 3 v, v i = v cc pull-downs ?n v i = v cc ??output voltage p2 0 ?2 7 , p4 1 ?4 7 , p5 0 ?5 7 , p6 0 ?6 7 , p7 0 , p7 1 (note) ??output voltage p0 0 ?0 7 , p1 0 ? 7 ??output voltage p2 0 ?2 7 , p4 1 ?4 7 , p5 0 ?5 7 , p6 0 ?6 7 , p7 0 , p7 1 (note) hysteresis int 0 ?nt 3 , adt, cntr 0, cntr 1, p2 0 ?2 7 hysteresis s clk , r x d hysteresis reset ??input current p0 0 ?0 7 , p1 0 ?1 7 , p3 4 ?3 7 ??input current p2 0 ?2 7 , p4 0 ?4 7 , p5 0 ?5 7 , p6 0 ?6 7 , p7 0 , p7 1 (note) v oh v ol v t+ ?v t v t+ ?v t v t+ ?v t i ih i ih i ih v cc ?.0 v cc ?.5 30 6.0 ?0 ?.0 0.5 0.5 70 2.0 0.5 45 140 5.0 5.0 ?.0 ?.0 ?40 ?5 v v v v v v v v v i ih i il v cc ?.0 v cc ?.0 v v v 1.0 v 1.0 5.0 a 25 v i = v cc v i = v cc v i = v ss v i = v ss pull-ups ?ff v cc = 5 v, v i = v ss pull-ups ?n v cc = 3 v, v i = v ss pull-ups ?n v i = v ss v i = v ss when clock is stopped ??input current reset ??input current x in ??input current p0 0 ?0 7 , p1 0 ?1 7 , p3 4 ?3 7 ,p4 0 ??input current p2 0 ?2 7 , p4 1 ?4 7 , p5 0 ?5 7 , p6 0 ?6 7 , p7 0 , p7 1 (note) ??input current reset ??input current x in ram hold voltage 4.0 ?.0 ?0 a a a a a a a a a a a i il i il i il v ram ?5 ?.0 no te: whe n ??is set to the port x c switch bit (bit 4 at address 003b 16 ) of cpu mode register, the drive ability of port p7 0 is different from the value above mentioned. t able 18 electrical characteristics (1) 1.8 5.5 v
rev.2.02 jun 19, 2007 page 67 of 73 rej03b0146-0202 3823 group (v cc = 1.8 to 5.5 v, ta = ?0 to 85 ?, unless otherwise noted) frequency/2 mode frequency/4 mode frequency/8 mode frequency/2/4/8 mode in wit state low-speed mode f(x in ) = stopped low-speed mode f(x in ) = stopped in wit state current increased at a/d converter operating all oscillation stopped ta = 25 ?, output transistors ?ff? (in stp state) all oscillation stopped ta = 85 ?, output transistors ?ff? (in stp state) v cc = 2.5 v, ta = 25 ? symbol parameter t est conditions i cc power source current t able 19 electrical characteristics (2) v cc = 5.0 v v cc = 2.5 v v cc = 5.0 v v cc = 2.5 v v cc = 5.0 v v cc = 2.5 v v cc = 5.0 v v cc = 2.5 v v cc = 5.0 v v cc = 2.5 v v cc = 5.0 v v cc = 2.5 v f(x in ) = 10 mhz f(x in ) = 8 mhz f(x in ) = 4 mhz f(x in ) = 4 mhz f(x in ) = 2 mhz f(x in ) = 10 mhz f(x in ) = 8 mhz f(x in ) = 4 mhz f(x in ) = 10 mhz f(x in ) = 8 mhz f(x in ) = 4 mhz f(x in ) = 2 mhz f(x in ) = 10 mhz f(x in ) = 8 mhz f(x in ) = 4 mhz f(x in ) = 2 mhz f(x in ) = 10 mhz f(x in ) = 8 mhz f(x in ) = 4 mhz f(x in ) = 2 mhz f(x in ) = 10 mhz f(x in ) = 8 mhz f(x in ) = 4 mhz f(x in ) = 2 mhz f(x in ) = 10 mhz f(x in ) = 8 mhz f(x in ) = 4 mhz f(x in ) = 2 mhz f(x cin ) = 32 khz on-chip oscillator f(x cin ) = 32 khz on-chip oscillator f(x cin ) = 32 khz on-chip oscillator f(x cin ) = 32 khz on-chip oscillator v cc = 5 v, all modes v cc = 2.5 v, all modes r oco on-chip oscillator oscillatoin limits min. unit t yp. max. 4.3 3.7 2.5 0.8 0.4 2.9 2.5 1.7 1.0 0.8 0.5 0.3 2.2 1.9 1.4 1.0 0.7 0.6 0.4 0.2 1.35 1.2 0.9 0.8 0.35 0.3 0.2 0.15 13 80 7 14 5.5 20 3.5 3.5 500 50 0.1 80 ma ma ma ma ma ma ma ma ma ma ma ma ma ma ma ma ma ma ma ma ma ma ma ma ma ma ma ma a a a a a a a a a a a a khz 8.6 7.4 5.0 1.6 0.8 5.8 5.0 3.4 2.0 1.6 1.0 0.6 4.4 3.8 2.8 2.0 1.4 1.2 0.8 0.4 2.7 2.4 1.8 1.6 0.7 0.6 0.4 0.3 26 240 14 42 11 60 7 10 1.0 10
rev.2.02 jun 19, 2007 page 68 of 73 rej03b0146-0202 3823 group (v cc = 1.8 to 5.5 v, ta = ?0 to 85 ?, unless otherwise noted) symbol parameter limits min. unit t yp. max. t est conditions abs t conv r ladder i vref i ia resolution absolute accuracy (excluding quantization error) conversion time ladder resistor reference power source input current analog port input current adl2 = ?? adl1 = ?? cpum7 = ? 2.2 v v cc = v ref 5.5 v f(x in ) = 2 ? v cc mhz 10 mhz adl2 = ?? adl1 = ?? cpum7 = ? 2.0 v v cc = v ref < 2.2 v f(x in ) = 4.4 mhz adl2 = ?? adl1 = ?? cpum7 = ? v cc = v ref = 4.0 to 5.5 v f(x in ) = 2 ? v cc mhz 10 mhz adl2 = ?? adl1 = ?? cpum7 = ??and expcm0 = ? v cc = v ref = 1.8 to 2.2 v f(x in ) = 8 mhz (adl2 = ?? adl1 = ?? cpum7 = ?? v ref = 5 v bits lsb lsb lsb lsb s k ? a a 8 ? ? ? ? tc(x in ) ? 100 100 200 5.0 t able 20 a/d converter characteristics (1) (in 8 bit a/d mode) 12 50 35 150 (v cc = 1.8 to 5.5 v, ta = ?0 to 85 ?, unless otherwise noted) symbol parameter limits min. unit t yp. max. t est conditions abs t conv r ladder i vref i ia resolution absolute accuracy (excluding quantization error) conversion time ladder resistor reference power source input current analog port input current adl2 = ?? adl1 = ?? cpum7 = ? 2.2 v v cc = v ref 5.5 v f(x in ) = 2 ? v cc mhz 10 mhz adl2 = ?? adl1 = ?? cpum7 = ? v cc = v ref = 4.0 to 5.5 v f(x in ) = 2 ? v cc mhz 10 mhz adl2 = ?? adl1 = ?? cpum7 = ??and expcm0 = ? v cc = v ref = 1.8 to 2.2 v f(x in ) = 8 mhz (adl2 = ?? adl1 = ?? cpum7 = ?? v ref = 5 v bits lsb lsb lsb s k ? a a 10 ? ? ? tc(x in ) ? 100 100 200 5.0 t able 21 a/d converter characteristics (2) (in 10 bit a/d mode) 12 50 35 150
rev.2.02 jun 19, 2007 page 69 of 73 rej03b0146-0202 3823 group (v cc = 4.0 to 5.5 v, v ss = 0 v, ta = ?0 to 85 ?, unless otherwise noted) note: when bit 6 of address 001a 16 is ??(clock synchronous). divide this limits value by four when bit 6 of address 001a 16 is ??(uart). t able 22 t iming requirements (1) note: when bit 6 of address 001a 16 is ??(clock synchronous). divide this limits value by four when bit 6 of address 001a 16 is ??(uart). (v cc = 1.8 to 4.0 v, v ss = 0 v, ta = ?0 to 85 ?, unless otherwise noted) t able 23 t iming requirements (2) 2 1000/(4 ? v cc ?) 100 45 40 45 40 1000/(2 ? v cc ?) 200 105 85 105 85 80 80 800 370 370 220 100 reset input ??pulse width main clock input cycle time (x in input) main clock input ??pulse width main clock input ??pulse width cntr 0 , cntr 1 input cycle time cntr 0 , cntr 1 input ??pulse width cntr 0 , cntr 1 input ??pulse width int 0 to int 3 input ??pulse width int 0 to int 3 input ??pulse width serial i/o clock input cycle time (note) serial i/o clock input ??pulse width (note) serial i/o clock input ??pulse width (note) serial i/o input set up time serial i/o input hold time t w(reset) t c(x in ) t wh(x in ) t wl(x in ) t c(cntr) t wh(cntr) t wl(cntr) t wh(int) t wl(int) t c(s clk ) t wh(s clk ) t wl(s clk ) t su(r x d? clk ) t h(s clk ? x d) symbol parameter limits min. s ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns unit t yp. max. 4.0 vcc < 4.5 v 4.5 vcc 5.5 v 4.0 vcc < 4.5 v 4.5 vcc 5.5 v 4.0 vcc < 4.5 v 4.5 vcc 5.5 v 4.0 vcc < 4.5 v 4.5 vcc 5.5 v 4.0 vcc < 4.5 v 4.5 vcc 5.5 v 4.0 vcc < 4.5 v 4.5 vcc 5.5 v 2 125 1000/(10 ? v cc ?2) 50 70 50 70 1000/v cc 1000/(5 ? v cc ?) t c(cntr) /2?0 t c(cntr) /2?0 230 230 2000 950 950 400 200 reset input ??pulse width main clock input cycle time (x in input) main clock input ??pulse width main clock input ??pulse width cntr 0 , cntr 1 input cycle time cntr 0 , cntr 1 input ??pulse width cntr 0 , cntr 1 input ??pulse width int 0 to int 3 input ??pulse width int 0 to int 3 input ??pulse width serial i/o clock input cycle time (note) serial i/o clock input ??pulse width (note) serial i/o clock input ??pulse width (note) serial i/o input set up time serial i/o input hold time t w(reset) t c(x in ) t wh(x in ) t wl(x in ) t c(cntr) t wh(cntr) t wl(cntr) t wh(int) t wl(int) t c(s clk ) t wh(s clk ) t wl(s clk ) t su(r x d? clk ) t h(s clk ? x d) symbol parameter limits min. s ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns ns unit t yp. max. 2.0 vcc 4.0 v vcc < 2.0 v 2.0 vcc 4.0 v vcc < 2.0 v 2.0 vcc 4.0 v vcc < 2.0 v 2.0 vcc 4.0 v vcc < 2.0 v
rev.2.02 jun 19, 2007 page 70 of 73 rej03b0146-0202 3823 group (v cc = 4.0 to 5.5 v, v ss = 0 v, ta = ?0 to 85 ?, unless otherwise noted) note : when the p4 5 /t x d p-channel output disable bit of the uart control register (bit 4 of address 001b 16 ) is ?? serial i/o clock output ??pulse width serial i/o clock output ??pulse width serial i/o output delay time (note) serial i/o output valid time (note) serial i/o clock output rising time serial i/o clock output falling time 140 30 30 symbol parameter limits min. ns ns ns ns ns ns unit t c (s clk )/2?0 t c (s clk )/2?0 ?0 t yp. max. t wh(s clk ) t wl(s clk ) t d(s clk ? x d) t v(s clk ? x d) t r(s clk ) t f(s clk ) (v cc = 1.8 to 4.0 v, v ss = 0 v, ta = ?0 to 85 ?, unless otherwise noted) ns ns ns ns ns ns unit note : when the p4 5 /t x d p-channel output disable bit of the uart control register (bit 4 of address 001b 16 ) is ?? serial i/o clock output ??pulse width serial i/o clock output ??pulse width serial i/o output delay time (note) serial i/o output valid time (note) serial i/o clock output rising time serial i/o clock output falling time 350 100 100 symbol parameter limits min. t c (s clk )/2?00 t c (s clk )/2?00 ?0 max. t wh(s clk ) twl(s clk ) t d(s clk ? x d) t v(s clk ? x d) t r(s clk ) t f(s clk ) t yp. fig. 69 circuit for measuring output switching characteristics t able 24 switching characteristics (1) t able 25 switching characteristics (2) m e a s u r e m e n t o u t p u t p i n 1 0 0 p f c m o s o u t p u t n ote: wh en bi t 4 o f t h e uart contro l reg i ster (addre ss 00 1b 16 ) is ?. (n-ch annel open- drai n output mode) n -c h anne l open- d ra i n output (n ote ) 1 k ? 100 p f m easurement output p i n
rev.2.02 jun 19, 2007 page 71 of 73 rej03b0146-0202 3823 group fig. 70 timing diagram t w ( r e s e t ) 0.8 v c c 0.2 v cc r e s e t t c(x in ) t c ( c n t r ) t w h ( c n t r ) t w l ( c n t r ) 0 . 8 v c c 0.2 v c c c n t r 0 , c n t r 1 t w h ( i n t ) t w l ( i n t ) 0 . 8 v c c 0.2 v c c i n t 0 i n t 3 t w h ( x i n ) t w l ( x i n ) 0.8 v c c 0.2 v c c x in t c(s clk ) t wl(s clk ) t w h ( s c l k ) 0 . 2 v c c 0.8 v c c s clk t r t f t d ( s c l k - t x d ) t v(s clk -t x d) t x d r x d 0.2 v cc 0.8 v cc t su(r x d-s clk ) t h(s clk -r x d)
rev.2.02 jun 19, 2007 page 72 of 73 rej03b0146-0202 3823 group p ackage outline y f * 3 * 1 * 2 1 24 25 40 41 64 65 80 index mark c b p d e h e a e z d z e h d detail f l a 1 a 2 include trim offset. dimension " * 3" does not note) do not include mold flash. dimensions " * 1" and " * 2" 1. 2. previous code jeita package code renesas code prqp0080gb-a 80p6n-a mass[typ.] 1.6g p-qfp80-14x20-0.80 0.2 0.15 0.13 0.45 0.35 0.3 max nom min dimension in millimeters symbol reference 20.2 20.0 19.8 d 14.2 14.0 13.8 e 2.8 a 2 23.1 22.8 22.5 17.1 16.8 16.5 3.05 a 0.2 0.1 0 0.8 0.6 0.4 l 10 0 c 0.8 e 0.10 y h d h e a 1 b p z d z e 0.65 0.95 0.8 1.0 diagrams showing the latest package dimensions and mounting information are available in the ?ackages?section of the renesas t echnology website.
rev.2.02 jun 19, 2007 page 73 of 73 rej03b0146-0202 3823 group detail f c a l 1 l a 1 a 2 index mark y * 2 * 1 * 3 f 80 61 60 41 40 21 20 1 x z e z d e h e d h d e b p 2. 1. dimensions " * 1" and " * 2" do not include mold flash. note) dimension " * 3" does not include trim offset. previous code jeita package code renesas code plqp0080kb-a 80p6q-a mass[typ.] 0.5g p-lqfp80-12x12-0.50 1.0 0.125 0.18 1.25 1.25 0.08 0.20 0.145 0.09 0.25 0.20 0.15 max nom min dimension in millimeters symbol reference 12.1 12.0 11.9 d 12.1 12.0 11.9 e 1.4 a 2 14.2 14.0 13.8 14.2 14.0 13.8 1.7 a 0.2 0.1 0 0.7 0.5 0.3 l x 10 0 c 0.5 e 0.08 y h d h e a 1 b p b 1 c 1 z d z e l 1 terminal cross section c bp c 1 b 1
revision history 3823 group data sheet rev. date description page summary (1/2) 1.00 05/13/05 first edition 2.00 05/07/07 6 table 3 is partly revised 8 fig.5 is partly added 9 table 4 is revised 14 rom code protect address is added fig.10 is revised 40 stp instruction execution is revised 49 oscillation control (1) stop mode is partly revised 52 lcd drive control circuit is revised 54 (6) wiring to p4 0 /(v pp ) pin is revised fig.59 is revised 55 fig.60 is partly deleted notes on qzrom is added 60 table 18 is partly added 2.01 05/11/08 6 table 3 is partly revised 61 table 19, 20 are partly revised 65-66 package outline revised 2.02 07/06/19 ?
revision history 3823 group data sheet rev. date description page summary (2/2) 2.02 07/06/19 67 table 19 r oco : ta = 25 ? added 72 note added
notes: 1. this document is provided for reference purposes only so that renesas customers may select the appropriate renesas product s for their use. renesas neither makes warranties or representations with respect to the accuracy or completeness of the information contained in this document nor grants any license to any intellectual property rights or any other rights of renesas or any third party with respect to the information in this document. 2. renesas shall have no liability for damages or infringement of any intellectual property or other rights arising out of t he use of any information in this document, including, but not limited to, product data, diagrams, charts, programs, algorithms, and application circuit examples. 3. you should not use the products or the technology described in this document for the purpose of military applications such as the development of weapons of mass destruction or for the purpose of any other military use. when exporting the products or technology described herein, you should follow the applicable export control laws and regulations, and procedures required by such laws and regulations. 4. all information included in this document such as product data, diagrams, charts, programs, algorithms, and application ci rcuit examples, is current as of the date this document is issued. such information, however, is subject to change without any prior notice. before purchasing or using any renesas products listed in this document, please confirm the latest product information with a renesas sales office. also, please pay regular and careful attentio n to additional and different information to be disclosed by renesas such as that disclosed through our website. (http://www.renesas.com ) 5. renesas has used reasonable care in compiling the information included in this document, but renesas assumes no liability whatsoever for any damages incurred as a result of errors or omissions in the information included in this document. 6. when using or otherwise relying on the information in this document, you should evaluate the information in light of the t otal system before deciding about the applicability of such information to the intended application. renesas makes no representations, warranties or guaranties regarding th e suitability of its products for any particular application and specifically disclaims any liability arising out of the application and use of the information in this do cument or renesas products. 7. with the exception of products specified by renesas as suitable for automobile applications, renesas products are not desi gned, manufactured or tested for applications or otherwise in systems the failure or malfunction of which may cause a direct threat to human life or create a risk of h uman injury or which require especially high quality and reliability such as safety systems, or equipment or systems for transportation and traffic, healthcare, combustion co ntrol, aerospace and aeronautics, nuclear power, or undersea communication transmission. if you are considering the use of our products for such purposes, please contact a r enesas sales office beforehand. renesas shall have no liability for damages arising out of the uses set forth above. 8. notwithstanding the preceding paragraph, you should not use renesas products for the purposes listed below: (1) artificial life support devices or systems (2) surgical implantations (3) healthcare intervention (e.g., excision, administration of medication, etc.) (4) any other purposes that pose a direct threat to human life renesas shall have no liability for damages arising out of the uses set forth in the above and purchasers who elect to us e renesas products in any of the foregoing applications shall indemnify and hold harmless renesas technology corp., its affiliated companies and their officers, dir ectors, and employees against any and all damages arising out of such applications. 9. you should use the products described herein within the range specified by renesas, especially with respect to the maximum rating, operating supply voltage range, movement power voltage range, heat radiation characteristics, installation and other product characteristics. renesas sha ll have no liability for malfunctions or damages arising out of the use of renesas products beyond such specified ranges. 10. although renesas endeavors to improve the quality and reliability of its products, ic products have specific characteristic s such as the occurrence of failure at a certain rate and malfunctions under certain use conditions. please be sure to implement safety measures to guard against the poss ibility of physical injury, and injury or damage caused by fire in the event of the failure of a renesas product, such as safety design for hardware and software includin g but not limited to redundancy, fire control and malfunction prevention, appropriate treatment for aging degradation or any other applicable measures. among others, sinc e the evaluation of microcomputer software alone is very difficult, please evaluate the safety of the final products or system manufactured by you. 11. in case renesas products listed in this document are detached from the products to which the renesas products are attached or affixed, the risk of accident such as swallowing by infants and small children is very high. you should implement safety measures so that renesas products may not be easily detached from your products. renesas shall have no liability for damages arising out of such detachment. 12. this document may not be reproduced or duplicated, in any form, in whole or in part, without prior written approval from r enesas. 13. please contact a renesas sales office if you have any questions regarding the information contained in this document, renes as semiconductor products, or if you have any other inquiries. sales strategic planning div. nippon bldg., 2-6-2, ohte-machi, chiyoda-ku, tokyo 100-0004, japan http://www.renesas.com refer to " http://www.renesas.com/en/network " for the latest and detailed information. renesas technology america, inc. 450 holger way, san jose, ca 95134-1368, u.s.a tel: <1> (408) 382-7500, fax: <1> (408) 382-7501 renesas technology europe limited dukes meadow, millboard road, bourne end, buckinghamshire, sl8 5fh, u.k. tel: <44> (1628) 585-100, fax: <44> (1628) 585-900 renesas technology (shanghai) co., ltd. unit 204, 205, aziacenter, no.1233 lujiazui ring rd, pudong district, shanghai, china 200120 tel: <86> (21) 5877-1818, fax: <86> (21) 6887-7898 renesas technology hong kong ltd. 7th floor, north tower, world finance centre, harbour city, 1 canton road, tsimshatsui, kowloon, hong kong tel: <852> 2265-6688, fax: <852> 2730-6071 renesas technology taiwan co., ltd. 10th floor, no.99, fushing north road, taipei, taiwan tel: <886> (2) 2715-2888, fax: <886> (2) 2713-2999 renesas technology singapore pte. ltd. 1 harbour front avenue, #06-10, keppel bay tower, singapore 098632 tel: <65> 6213-0200, fax: <65> 6278-8001 renesas technology korea co., ltd. kukje center bldg. 18th fl., 191, 2-ka, hangang-ro, yongsan-ku, seoul 140-702, korea tel: <82> (2) 796-3115, fax: <82> (2) 796-2145 renesas technology malaysia sdn. bhd unit 906, block b, menara amcorp, amcorp trade centre, no.18, jalan persiaran barat, 46050 petaling jaya, selangor darul ehsan, malaysia tel: <603> 7955-9390, fax: <603> 7955-9510 renesas sales offices ? 200 7. re nesas technology corp ., all rights reser v ed. printed in ja pan. colophon .7.0


▲Up To Search▲   

 
Price & Availability of M38230G4-XXXFP

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X